#include using namespace std; using Int = long long; constexpr static int mod = 1e9 + 7; constexpr static int inf = (1 << 30) - 1; constexpr static Int infll = (1LL << 61) - 1; int Competitive_Programming = (ios_base::sync_with_stdio(false), cin.tie(nullptr), cout << fixed << setprecision(15), 0); #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") // for query using osa_k way // init table vector sieve(int N) { vector res(N + 1); for (int i = 2; i <= N; i++) { if (res[i] == 0) { for (int j = i; j <= N; j += i) { if (res[j] == 0) res[j] = i; } } } return res; } // prime factorization O(log N) vector prime_factor(int N, const vector &min_factor) { // min_factor is vector which got by sieve() vector res; while (N > 1) { res.push_back(min_factor[N]); N /= min_factor[N]; } return res; } bool is_prime(int N, const vector &min_factor) { return min_factor[N] == N; } using ll = long long; ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) (res *= x) %= mod; (x *= x) %= mod; n >>= 1; } return res; } int main() { int N; cin >> N; auto mi = sieve(N + 1); int ex = 0; for (int i = N; i > 1; i--) { if (is_prime(i, mi)) { ex = i; break; } } vector mp(N + 1, 0); mp[1]++; for (int i = 2; i <= N; i++) { if (i == ex) continue; auto p = prime_factor(i, mi); map q; for (int j = 0; j < p.size(); j++) q[p[j]]++; for (auto &&e : q) mp[e.first] = max(mp[e.first], e.second); } Int ans = 1; int m = 998244353; for (int i = 2; i <= N; i++) { ans *= mod_pow((Int)i, mp[i], m); ans %= m; } cout << ans << '\n'; }