N = gets.to_i sum = (1 + (N - 1)) * (N - 1) / 2 ans = 0 1.upto(Math.sqrt(N).floor+1) {|i| if N % i == 0 and sum % i == 0 ans += i ans += (N / i) if sum % (N / i) == 0 and (N / i) ** 2 != 0 end } puts ans