#include #include #include using namespace std; using mint=atcoder::modint998244353; bool fm[150]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); for(int n=0;n<10;n++)fm[n]=true; for(int n=10;n<150;n++) { string s=to_string(n); bool ok=true; for(int i=1;is[i])ok=false; if(ok) { int c=0; for(char d:s)c+=d-'0'; if(fm[c])fm[n]=true; } } int T;cin>>T; for(;T--;) { long N;cin>>N; long V=N+1; while(true) { string s=to_string(V); {//m for(int i=1;i=V) {//1 -> 9 (+8) long t=min(V/8,N+1); ans+=(mint(10).pow(t)-1)/9*8; V-=t*8; ans+=mint(10).pow(t)*V; } else {assert(false); ans+=(mint(10).pow(N+1)-1)/9*8; V-=(N+1)*8; ans+=(mint(10).pow(V/9)-1+V%9*mint(10).pow(V/9))*mint(10).pow(N+1); } cout<