Calculating fractions in rectangle model