# 1001 Tetrahedron

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 998244353;
const int N = 6e6+7;

int inv[N];
int sum[N];

void init()
{
inv[1] = 1;
for(int i=2;i<N;i++)
inv[i] = (LL)(mod-mod/i)*inv[mod%i]%mod;   //预处理逆元，注意 LL
for(int i=1;i<N;i++)
sum[i] = (sum[i-1] + (LL)inv[i]*inv[i]%mod)%mod;  //提出公因数后预处理 ，注意 LL
}

int main()
{	init();
int T;
scanf("%d",&T);
while(T--){
int n;
scanf("%d",&n);
printf("%d\n",((LL)3*sum[n]*inv[n]+mod)%mod);  // 最后再/n
}
return 0;
}


# 1009 Paperfolding

1、 ( a + b ) n = ∑ i = 0 n ( C n i a i b n − i ) (a+b)^{n}=\sum_{i=0}^{n}(C_{n}^{i}a^{i} b^{n-i})
2、 2 n = ∑ i = 0 n C n i 2^n=\sum_{i=0}^{n} C_{n}^{i}

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 998244353;
const int N = 6e6+7;

LL quick(LL a,LL b){
LL ans=1;
while(b){
if(b&1) ans = ans*a%mod;
a = a*a%mod;
b>>=1;
}
return ans;
}

int main()
{
int T;
scanf("%d",&T);
while(T--){
LL n;
scanf("%lld",&n);
printf("%d\n",(quick(2,n)+1+2*quick(3,n)*quick(quick(2,n),mod-2)%mod+mod)%mod);
}
return 0;
}