N = input() S = str(N) L = len(S) MOD = 998244353 dp = [[[[[0]*10 for _ in range(2)] for _ in range(2)] for _ in range(2)] for _ in range(2)] dp[0][0][0][0][0] = 1 for i in range(L): for zero in range(2): for small in range(2): for d in range(2): for j in range(10): if dp[0][zero][small][d][j] == 0: continue if zero == 0: dp[1][zero][1][0][j] += dp[0][zero][small][0][j] dp[1][zero][1][0][j] %= MOD for k in range(1, 10 if small else int(S[i])+1): dp[1][1][small or k