require'prime';n=gets.to_i;s=1;(n>>1-n%2).prime_division.each{|n,p|s*=(n**(p+1)-1)/~-n};p s