import sys p, g, ig = 998244353, 3, 332748118 W = [pow(g, (p - 1) >> i, p) for i in range(24)] iW = [pow(ig, (p - 1) >> i, p) for i in range(24)] def fft(k, f): for l in range(k, 0, -1): d = 1 << l - 1 U = [1] for i in range(d): U.append(U[-1] * W[l] % p) for i in range(1 << k - l): for j in range(d): s = i * 2 * d + j f[s], f[s+d] = (f[s] + f[s+d]) % p, U[j] * (f[s] - f[s+d]) % p def ifft(k, f): for l in range(1, k + 1): d = 1 << l - 1 for i in range(1 << k - l): u = 1 for j in range(i * 2 * d, (i * 2 + 1) * d): f[j+d] *= u f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p u = u * iW[l] % p def convolve(a, b): n0 = len(a) + len(b) - 1 k = (n0).bit_length() n = 1 << k a = a + [0] * (n - len(a)) b = b + [0] * (n - len(b)) fft(k, a), fft(k, b) for i in range(n): a[i] = a[i] * b[i] % p ifft(k, a) invn = pow(n, p - 2, p) for i in range(n0): a[i] = a[i] * invn % p del a[n0:] return a MOD = p #MOD = 998244353 def mul(a, b): return ((a % MOD) * (b % MOD)) % MOD def div(a, b): return mul(a, pow(b, MOD-2, MOD)) def div2(a, b): return mul(a, modinv(b)) def modinv(a): b, u, v = MOD, 1, 0 while b: t = a//b a, u = a-t*b, u-t*v a, b, u, v = b, a, v, u u %= MOD return u def frac(limit): frac = [1]*limit for i in range(2,limit): frac[i] = i * frac[i-1]%MOD fraci = [None]*limit fraci[-1] = pow(frac[-1], MOD -2, MOD) for i in range(-2, -limit-1, -1): fraci[i] = fraci[i+1] * (limit + i + 1) % MOD return frac, fraci frac, fraci = frac(100001) def cmb(a, b): if not a >= b >= 0: return 0 return frac[a]*fraci[b]*fraci[a-b]%MOD N, = map(int, input().split()) F = [0]*N G = [0]*N G[0] = 1 for i in range(N-1): G[i+1] = G[i]*N #print(G) for i in range(N): F[i] = cmb(N, i) G[i] = G[i]* div2(1, frac[i]) #print(F) #print(G) H = convolve(F, G) #print(H) R = div2(frac[N-2], pow(N, N-2, MOD))*H[N-2]%MOD print(R)