#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cstring>
#include<vector>
#define inf 1e9
#define ll long long
#define For(i,j,k) for(ll i=j;i<=k;i++)
#define Dow(i,j,k) for(ll i=k;i>=j;i--)
using namespace std;
ll mo=1000000007;
ll n,tot,pri[10000001],ans;
bool bj[100000001];
void get_pri()
{
For(i,2,n)
{
if(!bj[i])
pri[++tot]=i;
For(j,1,tot)
{
if(i*pri[j]>n) break;
bj[i*pri[j]]=1;
if(i%pri[j]==0) break;
}
}
}
ll ksm(ll x,ll y)
{
ll sum=1;for(;y;y>>=1){if(y&1)sum=sum*x%mo;x=x*x%mo;} return sum;
}
int main()
{
scanf("%lld",&n);
get_pri();
ans=1;
For(i,1,tot)
{
ll num=pri[i];
// cout<<num<<endl;
ll t=log(n)/log(num);
ans=(ans*ksm(num,t))%mo;
// cout<<num<<' '<<t<<' '<<ksm(num,t)<<endl;
}
printf("%lld\n",ans);
}