module NuisanceBalls def solve(n) a = [] [720, 360, 180, 30, 6, 1].reduce(n) do |x, y| a << x / y x % y end s = 'CMSRo.' a.zip(s.each_char).reduce(''){|x, (y, z)| x + z * y} end module_function :solve end if $0 == __FILE__ n = gets.chomp.to_i puts NuisanceBalls.solve(n) end