Ruby: Exercise in working with arithmetic