#include using namespace std; #define int long long typedef pair P; int INF = 3e18+7; int mod = 998244353; int dx[] = {1, 0,-1, 0, 1, 1,-1,-1}; int dy[] = {0, 1, 0,-1, 1,-1, 1,-1}; int mod_pow(int x,int y) { int res = 1; while(y > 0) { if(y%2) { res = res*x%mod; } x = x*x%mod; y/=2; } return res; } int fac[1000005], finv[1000005], inv[1000005]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < 1000005; i++){ fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod%i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } int COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % mod) % mod; } signed main() { int N; cin >> N; if(N == 1) { cout << 0 << endl; return 0; } if(N == 2) { cout << 2 << endl; return 0; } COMinit(); int ans = fac[N]*N%mod; for(int i = 1; i <= N; i++) { ans = (ans+mod-COM(i-1,1)*2%mod*(N-i+1)%mod*fac[N-2]%mod)%mod; ans = (ans+mod-COM(i-1,2)*2*(N-2)%mod*(N-i+1)%mod*fac[N-3]%mod)%mod; ans = (ans+COM(N-i,2)*2*(N-2)%mod*(N-i+1)%mod*fac[N-3])%mod; } cout << ans << endl; }