#include"iostream" #include"algorithm" #include"cstring" #include"cstdio" #include"cmath" #include"vector" #include"map" #include"set" #include"queue" usingnamespace std; #define MAXN 3000006 //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i) #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define vi vector<int> #define all(x) (x).begin() , (x).end() #define mem( a ) memset( a , 0 , sizeof a ) #define P 1000000007 typedeflonglong ll; int n;
intPow( int x , int a ){ int ret = 1; while( a ) { if( a & 1 ) ret = 1ll * ret * x % P; x = 1ll * x * x % P , a >>= 1; } return ret; }
intphi( int x ){ int res = x; for( int i = 2 ; i * i <= x ; ++ i ) if( x % i == 0 ) { res = res - res / i , x /= i; while( x % i == 0 ) x /= i; } if( x != 1 ) res = res - res / x; return res; }
voidsolve(){ scanf("%d",&n); int res = 0; for( int i = 1 ; i * i <= n ; ++ i ) if( n % i == 0 ) { ( res += 1ll * Pow( n , i ) * phi( n / i ) % P ) %= P; if( i * i != n ) ( res += 1ll * Pow( n , n / i ) * phi( i ) % P ) %= P; } printf("%d\n",1ll * res * Pow( n , P - 2 ) % P); }