#include using namespace std; using ll = long long; #define all(p) p.begin(),p.end() #define rep(i,a,b) for(int i=(int)a;i<(int)b;i++) const int mod=998244353; int main(){ int N; cin>>N; string X; cin>>X; int M=11; vector dp(M); int val=0; rep(i,0,N){ vector n_dp(M); if(i) dp[0]++; rep(j,0,M) rep(k,0,10){ if((2*j-k+M)%M==0) continue; n_dp[(k-j+M)%M]+=dp[j]; } rep(k,0,X[i]-'0'){ if((2*val-k+M)%M==0) continue; n_dp[(k-val+M)%M]++; } val=((int)(X[i]-'0')+M-val)%M; swap(n_dp,dp); for(auto &x:dp) x%=mod; } ll ans=dp[0]; vector p(N+1); rep(i,0,N) p[i+1]=((int)(X[i]-'0')*(1-2*(i%2))+p[i]); if(val%M==0){ ans++; rep(i,0,N){ int a=p[i]; int b=p[N]-p[i+1]; int c=(a-b)%M; if((c+M)%M==0){ ans--; break; } } } cout<