import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = ni() X = [int(x) for x in input()] m = 11 mod = 998244353 # e0 = set() # e1 = {0} # def f(s, x): # return set([y * 10 + x for y in s]) # def merge(s1, s2): # return s1 | s2 e0 = 0 e1 = 1 def f(s, x): return s def merge(s1, s2): return (s1 + s2) % mod def solve(n, X): dp = [[e0 for i in range(4)] for i in range(m)] dp[0][0] = e1 for i in range(n): ndp = [[e0 for i in range(4)] for i in range(m)] ndp, dp = dp, ndp for j in range(m): for k in range(4): p, q = k//2, k%2 if ndp[j][k] == e0:continue for x in range(10): np = p nq = q xj = x if (n-i-1) % 2 else (-x)%m nj = (j + xj)%m if (xj+j * 2)%m == 0 and p:continue if x != 0: np = 1 if q == 0 and x > X[i]: continue if x < X[i]: nq = 1 nk = np*2 + nq dp[nj][nk] = merge(dp[nj][nk], f(ndp[j][k], x)) #print(dp) return merge(dp[0][2], dp[0][3]) print(solve(n, X)) #print(solve_greedy(n, X)) #print(solve2(n, X))