例题
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define INF 0x3f3f3f3f3f
const int N = 1000010;
const int mod = 998244353;
using namespace std;
int arr[N];
//1 ≤ Q ≤ 6e10
//当然是要用快速幂
int qmi(int a,int b,int mod){
a %= mod;
int res = 1;
while(b>0){
if(b&1) res = res*a%mod;
a = a*a%mod;
b >>= 1;
}
return res;
}
signed main()
{
int n;
cin>>n;
queue<int> s;
//插入队头 1
s.push(1);
int ans = 1;
while(n--){
int t;
cin>>t;//判断是哪个类型
if(t == 1){
int num;
cin>>num;
ans = (ans*10 +num)%mod;
//入队
s.push(num);
}else if(t ==2){
//删除S最前面
//eg : 123456 删最前面 要删 100000
//记录 首位 1和 最高次位 6 ans = ans- 1*10^(6-1)
// ans = ans - 首位* 10^n-1
int first = s.front();
s.pop();
ans = (ans-(first*qmi(10,s.size(),mod))%mod+mod)%mod; //搞这么多mod是为了防超规模
}else
cout<<ans<<endl;
}
return 0;
}