Calculation of returns on investments and loans