#include using namespace std; using ll = long long; constexpr int mod = 998244353; void ch(int &a, int b) { a = a + b; if (a >= mod) a -= mod; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; string X; cin >> N >> X; for (auto &i : X) i -= '0'; vector dp0(N, vector(11, 0)), dp1(N, vector(11, 0)); for (int i = 1; i < X[0]; i++) { dp1[0][i] = 1; } dp0[0][X[0]] = 1; for (int i = 1; i < N; i++) { for (int j = 0; j < 11; j++) { for (int k = 0; k < 10; k++) { if ((j * 2 - k) % 11 != 0) { ch(dp1[i][(j * 10 + k) % 11], dp1[i - 1][j]); } } for (int k = 0; k < X[i]; k++) { if ((j * 2 - k) % 11 != 0) { ch(dp1[i][(j * 10 + k) % 11], dp0[i - 1][j]); } } if ((j * 2 - X[i]) % 11 != 0) { ch(dp0[i][(j * 10 + X[i]) % 11], dp0[i - 1][j]); } } for (int k = 1; k < 10; k++) { ch(dp1[i][k], 1); } } int ans = 0; ch(ans, dp0[N - 1][0]); ch(ans, dp1[N - 1][0]); cout << ans << '\n'; }