#include"iostream" #include"algorithm" #include"cstring" #include"cstdio" #include"cmath" #include"vector" #include"map" #include"set" #include"queue" usingnamespace std; #define MAXN 1000006 //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i) #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define vi vector<int> #define all(x) (x).begin() , (x).end() #define mem( a ) memset( a , 0 , sizeof a ) typedeflonglong ll; constint P = 998244353; int n , m; int A[MAXN]; double S[MAXN]; int s[MAXN] , iv[MAXN];
intPow( int x , int a ){ int ret = 1; while( a ) { if( a & 1 ) ret = ret * 1ll * x % P; x = x * 1ll * x % P , a >>= 1; } return ret; }
voidsolve(){ rep( i , 1 , MAXN - 1 ) S[i] = S[i - 1] + 1. / i , iv[i] = Pow( i , P - 2 ) , s[i] = ( s[i - 1] + iv[i] ) % P; int T; cin >> T; while( T-- ) { scanf("%d",&n); if( n == 1 ) { puts("1"); continue; } int d = upper_bound( S + 1 , S + 1 + n , S[n - 1] - 1 ) - S; printf("%d\n",( s[n - 1] + P - s[d - 1] ) * 1ll * d % P * iv[n] % P); } }