MOD = 998244353 N = int(input()) X = list(input()) X = [int(x) for x in X] dp = [0] * 22 dp[0 * 11 + 0] = 1 for i in range(N): ndp = [0] * 22 ndp[1 * 11 + 0] = 1 for j in range(10): if j < X[i]: for k in range(11): if (9 * k + j) % 11 == 0: continue ndp[1 * 11 + (10 * k + j) % 11] += dp[0 * 11 + k] ndp[1 * 11 + (10 * k + j) % 11] += dp[1 * 11 + k] elif j == X[i]: for k in range(11): if (9 * k + j) % 11 == 0: continue ndp[0 * 11 + (10 * k + j) % 11] += dp[0 * 11 + k] ndp[1 * 11 + (10 * k + j) % 11] += dp[1 * 11 + k] else: for k in range(11): if (9 * k + j) % 11 == 0: continue ndp[1 * 11 + (10 * k + j) % 11] += dp[1 * 11 + k] for j in range(22): ndp[j] %= MOD dp = ndp ans = (dp[0 * 11 + 0] + dp[1 * 11 + 0] - 1) % MOD print(ans)