#include using namespace std; using ll = int64_t; using ld = long double; using P = pair; using Pld = pair; using Vec = vector; using VecP = vector

; using VecB = vector; using VecC = vector; using VecD = vector; using VecS = vector; template using Vec2 = vector>; #define REP(i, m, n) for(ll i = (m); i < (n); ++i) #define REPN(i, m, n) for(ll i = (m); i <= (n); ++i) #define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i) #define REPNR(i, m, n) for(ll i = (m); i >= (n); --i) #define rep(i, n) REP(i, 0, n) #define repn(i, n) REPN(i, 1, n) #define repr(i, n) REPR(i, n, 0) #define repnr(i, n) REPNR(i, n, 1) #define all(s) (s).begin(), (s).end() template bool chmax(T1 &a, const T2 b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T1 &a, const T2 b) { if (a > b) { a = b; return true; } return false; } template istream &operator>>(istream &is, vector &v) { for (T &i : v) is >> i; return is; } template ostream &operator<<(ostream &os, const vector &v) { for (const T &i : v) os << i << ' '; return os; } void co() { cout << '\n'; } template void co(Head&& head, Tail&&... tail) { cout << head << ' '; co(forward(tail)...); } void ce() { cerr << '\n'; } template void ce(Head&& head, Tail&&... tail) { cerr << head << ' '; ce(forward(tail)...); } void sonic() { ios::sync_with_stdio(false); cin.tie(nullptr); } void setp(const int n) { cout << fixed << setprecision(n); } constexpr int64_t LINF = 1000000000000000001; constexpr int64_t MOD = 1000000007; constexpr int64_t MOD_N = 998244353; constexpr long double EPS = 1e-11; const double PI = acos(-1); template struct ModInt { int64_t x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt &operator+=(const ModInt &rhs) { if((x += rhs.x) >= mod) x -= mod; return *this; } ModInt &operator-=(const ModInt &rhs) { if((x += mod - rhs.x) >= mod) x -= mod; return *this; } ModInt &operator*=(const ModInt &rhs) { x = (int) (1LL * x * rhs.x % mod); return *this; } ModInt &operator/=(const ModInt &rhs) { *this *= rhs.inverse(); return *this; } ModInt &operator++() { if((++x) >= mod) x -= mod; return *this; } ModInt operator++(int) { ModInt tmp(*this); operator++(); return tmp; } ModInt &operator--() { if((x += mod - 1) >= mod) x -= mod; return *this; } ModInt operator--(int) { ModInt tmp(*this); operator--(); return tmp; } ModInt operator-() const { return ModInt(-x); } ModInt operator+(const ModInt &rhs) const { return ModInt(*this) += rhs; } ModInt operator-(const ModInt &rhs) const { return ModInt(*this) -= rhs; } ModInt operator*(const ModInt &rhs) const { return ModInt(*this) *= rhs; } ModInt operator/(const ModInt &rhs) const { return ModInt(*this) /= rhs; } bool operator==(const ModInt &rhs) const { return x == rhs.x; } bool operator!=(const ModInt &rhs) const { return x != rhs.x; } ModInt inverse() const { int a = x, b = mod, u = 1, v = 0, t; while (b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return ModInt(u); } ModInt pow(int64_t n) const { ModInt res(1), mul(x); while (n > 0) { if(n & 1) res *= mul; mul *= mul; n >>= 1; } return res; } void pow_self(int64_t n) { ModInt tmp = pow(n); swap(*this, tmp); } friend ostream &operator<<(ostream &os, const ModInt &rhs) { return os << rhs.x; } friend istream &operator>>(istream &is, ModInt &rhs) { int64_t t; is >> t; rhs = ModInt< mod >(t); return (is); } int to_int() const { return x; } static int get_mod() { return mod; } }; using Mint = ModInt; struct prime_number { vector data; prime_number() { init(); } void init() { constexpr int sz = 4194304; bitset is_not_prime; is_not_prime[0] = is_not_prime[1] = true; for (int64_t i = 2; i < sz; ++i) { if (!is_not_prime[i]) { data.push_back(i); for (int64_t j = 2; i * j < sz; ++j) { is_not_prime[i * j] = true; } } } } bool is_prime(int64_t n) { if (n == 1) return false; for (auto i : data) { if (i * i > n) break; if (n % i == 0) return false; } return true; } vector> prime_factorization(int64_t n) { vector> res; for (auto i : data) { int64_t cnt = 0; while (n % i == 0) { n /= i; cnt++; } if (cnt) res.push_back({i, cnt}); if (n < i * i) break; } if (n != 1) res.push_back({n, 1}); return res; } int64_t pow_int(int64_t x, int64_t n) { int64_t res = 1; while (n) { if (n & 1) res *= x; x *= x; n >>= 1; } return res; } vector divisors(int64_t n) { auto v = prime_factorization(n); vector res, a, b, cp; res.push_back(1); for (auto p : v) { cp.resize(res.size()); copy(res.begin(), res.end(), cp.begin()); a.resize(res.size()); for (int64_t k = 1; k <= p.second; ++k) { int64_t t = pow_int(p.first, k); for (int64_t i = 0; i < a.size(); ++i) a[i] = cp[i] * t; merge(res.begin(), res.end(), a.begin(), a.end(), back_inserter(b)); swap(res, b); b.clear(); } } return res; } }; prime_number pn; template struct math_mod { using mint = ModInt; vector fac, finv; math_mod() { _init(3000000); } void _init(const int64_t n) { if (fac.size() > n) return; const int m = fac.size(); fac.resize(n + 1); for (int64_t i = m; i <= n; ++i) { if (i == 0) fac[i] = 1; else fac[i] = fac[i - 1] * i; } finv.resize(n + 1); finv[n] = fac[n].inverse(); for (int64_t i = n - 1; i >= m; --i) finv[i] = finv[i + 1] * (i + 1); } mint fact(int64_t x) { assert(x >= 0 && x < fac.size()); return fac[x]; } mint combi(int64_t n, int64_t k) { if (n < k || n < 0 || k < 0) return 0; _init(n); return fac[n] * finv[k] * finv[n - k]; } mint combi_naive(int64_t n, int64_t k) { if (n - k < k) n = n - k; if (n < k || n < 0 || k < 0) return 0; mint res = 1; for (int64_t i = 0; i < k; ++i) { res *= n - i; res /= i + 1; } return res; } mint permu(int64_t n, int64_t k) { if (n < k || n < 0 || k < 0) return 0; _init(n); return fac[n] * finv[n - k]; } mint factorial(int64_t n) { if (n > 4000000) return 0; mint ans = 1; for (auto p : pn.data) { if (n < p) break; int64_t c = 0, t = p; while (t <= n) { c += n / t; t *= p; } ans *= mint(p).pow(c); } return ans; } }; math_mod math; int main(void) { ll n; cin >> n; co(math.factorial(n)); return 0; }