Calculation of remaining funds