#pragma GCC optimization ("O3") #include using namespace std; using ll = long long; using vec = vector; using mat = vector; using pll = pair; #define INF (1LL<<61) //#define MOD 1000000007LL #define MOD 998244353LL #define EPS (1e-10) #define PR(x) cout << (x) << endl #define PS(x) cout << (x) << " " #define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i)) #define FORE(i,v) for(auto (i):v) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((ll)(x).size()) #define REV(x) reverse(ALL((x))) #define ASC(x) sort(ALL((x))) #define DESC(x) {ASC((x)); REV((x));} #define BIT(s,i) (((s)>>(i))&1) #define pb push_back #define fi first #define se second template inline int chmin(T& a, T b) {if(a>b) {a=b; return 1;} return 0;} template inline int chmax(T& a, T b) {if(a=MOD) x-=MOD; return *this;} mint& operator-=(const mint& a) {if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;} mint& operator*=(const mint& a) {(x*=a.x)%=MOD; return *this;} mint operator+(const mint& a) const {mint b(*this); return b+=a;} mint operator-(const mint& a) const {mint b(*this); return b-=a;} mint operator*(const mint& a) const {mint b(*this); return b*=a;} mint pow(ll t) const {if(!t) return 1; mint a=pow(t>>1); return (t&1?*this*a:a)*a;} mint inv() const {return pow(MOD-2);} mint& operator/=(const mint& a) {return *this*=a.inv();} mint operator/(const mint& a) const {mint b(*this); return b/=a;} }; istream &operator>>(istream& is, mint& a) {ll t; is>>t; a=t; return is;} ostream &operator<<(ostream& os, const mint& a) {return os<; vec convolution(vec a, vec b) { struct LocalFunc { static ll modpow(ll a, ll n) { if(n == 0) return 1; ll t = modpow(a, n>>1); return (n&1?a*t%MOD:t)*t%MOD; } static void ntt(vec& a, bool rev=false) { ll i, j, k, l, p, q, r, s; ll size = a.size(); if(size == 1) return; vec b(size); r = rev?(MOD-1-(MOD-1)/size):(MOD-1)/size; s = modpow(3, r); vec kp(size/2+1, 1); for(i=0; i>=1){ for(j=0, r=0; j=q)?(p-q):(MOD-q+p))%MOD; } } swap(a, b); } if(rev){ s = modpow(size, MOD-2); for(i = 0; i < size; i++) a[i] = a[i]*s%MOD; } } }; ll size = a.size()+b.size()-1; ll t = 1; while(t < size) t <<= 1; vec A(t, 0), B(t, 0); for(ll i=0; i>1); return convolution((n&1?convolution(A, B):B), B); } int main() { ll N; cin >> N; vec A(N-1); mint t(1); REP(i,0,N-1) { if(i) t *= i; A[i] = (mint(i+1)/t).x; } mint ans = t*mint(N).pow(N-2).inv(); A = ppow(A, N); ans *= mint(A[N-2]); PR(ans.x); return 0; } /* */