def gcd(a, b): if b==0: return a return gcd(b, a%b) n=int(input()) g=gcd(n*(n+1)//2, n) ans=0 for i in range(1, n+1): if i*i>n: break if n%i==0: ans+=i if i*i