#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

static const int MODVAL = 1000000007;
class ThePermutationGame { public:
	int findMin(int N)
	{
		LL ans = 1;

		vector<bool> isp(N+1, true);
		for(int p=2; p<=N; ++p)
			if( isp[p] ) {
				for(int q=p+p; q<=N; q+=p)
					isp[q] = false;
				for(int v=p; v<=N; v*=p)
					ans = (ans*p) % MODVAL;
			}
		return int(ans);
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, ThePermutationGame().findMin(N));}
int main(){

CASE(0)
	int N = 2; 
	int _ = 2; 
END
CASE(1)
	int N = 3; 
	int _ = 6; 
END
CASE(2)
	int N = 11; 
	int _ = 504; 
END
CASE(3)
	int N = 102; 
	int _ = 841777601; 
END
CASE(4)
	int N = 9999; 
	int _ = 804862568; 
END
/*
CASE(5)
	int N = ; 
	int _ = ; 
END
CASE(6)
	int N = ; 
	int _ = ; 
END
*/
}
// END CUT HERE
