Automatically calculates total expenditure