#include /*#include #include */#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; /*namespace mp = boost::multiprecision; using Bint = mp::cpp_int; using Real = mp::number>; */#define lli long long int #define uli unsigned long long int #define INF 999999999999 #define rep(i,m,n) for(lli i = m;i < n;i++) #define rrep(i,m,n) for(lli i=m-1;i>=n;i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(),N.end()),N.end()); #define Sort(n) sort(n.begin(), n.end()) #define Rev(n) reverse(n.begin(),n.end()) #define Out(S) cout << S << endl #define NeOut(S) cout << S #define HpOut(S) cout << setprecision(50) << S << endl #define Vec(K,L,N,S) vector K(N,S) #define DV(K,L,N,M,S) vector> K(N,vector(M,S)) #define TV(K,L,N,M,R,S) vector>> K(N,vector>(M,vector(R,S))) #define pint pair #define paf(L,R) pair #define mod 998244353 #define MAX 10000000 #define ALL(a) a.begin(),a.end() #define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) #define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a/b; a -= t*b; swap(a, b); u -= t*v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } int main(){ ios::sync_with_stdio(false); cin.tie(0); long long N,sum=0; cin >> N; vectordp1(N+1,1); vectordp2(N+1,0); dp2[0]=1; rep(i,2,N+1)dp1[i]=dp1[i-1]*i%mod; rep(i,2,N+1)sum=(sum+mod+(long long)pow(-1,i%2)*(dp1[N]*modinv(dp1[i],mod)%mod))%mod; rep(i,4,N+1){ if(i&1)dp2[i]=((i-1)*dp2[i-1]%mod+2*(i-1)*dp2[i-2]%mod)%mod; else dp2[i]=((i-1)*dp2[i-1]%mod+2*(i-2)*dp2[i-4]%mod)%mod; } Out((dp1[N]-2*sum+dp2[N]+mod)%mod); }