require 'prime' n = gets.to_i n = n.gcd(n * (n + 1) / 2) p n.prime_division.inject(1){|a, b| t = 0 (0..b[1]).each do |i| t += b[0]**i end a *= t }