Calculation of total investment