N = [int(s) for s in input()] pre0 = [[0] * 10 for _ in range(10)] pre1 = [[0] * 10 for _ in range(10)] if len(N) <= 2: ans = "" for n in N: ans += str(n) print(ans) exit() st = "" for n in N[:2]: st += str(n) st = int(st) for i in range(st): pre0[i // 10][i % 10] = 1 pre1[N[0]][N[1]] = 1 mod = 998244353 for n in N[2:]: dp0 = [[0] * 10 for _ in range(10)] dp1 = [[0] * 10 for _ in range(10)] for a in range(10): for b in range(10): for c in range(10): if a == 4 and b == 0 and c == 4: continue dp0[b][c] += pre0[a][b] dp0[b][c] %= mod if a != 4 or b != 0 or n != 4: dp1[b][n] += pre1[a][b] dp1[b][n] %= mod for c in range(n): if a == 4 and b == 0 and c == 4: continue dp0[b][c] += pre1[a][b] dp0[b][c] %= mod dp0, pre0 = pre0, dp0 dp1, pre1 = pre1, dp1 ans = -1 for i in range(10): for j in range(10): ans += pre0[i][j] ans += pre1[i][j] ans %= mod print(ans)