port calculator1 to ruby