Calculation of total discount