n = gets.chomp.to_i if n % 2 == 0 puts 1 else m = Math.sqrt(n).floor sum = 0 (1 .. m).each do |i| sum += i + n / i if n % i == 0 end puts sum end