product formula in ruby