#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template using V=vector; template using VV=V>; const int MOD=998244353; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll m; cin>>m; string s; cin>>s; int n=s.size(); ll t=1; reverse(ALL(s)); V S(n),C(n); rep(i,n){ ll a=s[i]-'0'; if(a<=(m-1)%10){ C[i]=(m-1)/10+1; if(a==0) C[i]--; } else{ C[i]=(m-1)/10; if(a==0) C[i]--; } if(a!=0) S[i]=C[i]*(a+5*(C[i]-1)%MOD)%MOD; else S[i]=C[i]*(10+5*(C[i]-1)%MOD)%MOD; } V L(n),R(n); L[0]=C[0],R[n-1]=C[n-1]; for(int i=1;i=0;i--) R[i]=R[i+1]*C[i]%MOD; ll ans=0; rep(i,n){ ll tmp=S[i]*t%MOD; if(i) tmp=tmp*L[i-1]%MOD; if(i