n=gets.to_i s=0 1.upto(a=(n=n>>1-n%2)**0.5){|k|n%k<1&&s+=k+=a==k ?0:n/k} p s