#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000 int main(){ int n; cin>>n; string s; cin>>s; vector dp(5,0); dp[3] = 1; rep(i,n){ vector ndp(5,0); rep(j,10){ if(s[i]!='?'&&s[i]-'0'!=j)continue; rep(k,3){ ndp[(k+j)%3] += dp[k]; } rep(k,3){ if((k+j)%3==0){ ndp[4] += dp[k]; } } if(j%3==0){ ndp[4] += dp[3]; } ndp[j%3] += dp[3]; } ndp[3] += dp[3]; ndp[4] += dp[4]; swap(dp,ndp); } cout<