Calculates payment