from collections import defaultdict mod = 998244353 U = 211 def id(x, y): return x * U + y def parse(x): a = x // U return a, x - U * a def dec(x): if x < 10: return 1 if x < 100: return 2 return 3 """ sum + 1 == len 1: sum += 1, len += 2 2: sum += 2, len += 2 x: sum += x, len += dec(x) + 1 """ n = int(input()) dp = defaultdict(int) dp[0] = 1 for i in range(n): # ok = n - i - 1 + 10 ndp = defaultdict(int) for k, v in dp.items(): s, l = parse(k) for a in range(1, U): ns = s + a nl = l + dec(a) + 1 if ns >= U or nl >= U: break if ns - nl > n: break nk = id(ns, nl) ndp[nk] += v ndp[nk] %= mod dp = ndp ans = 0 for k, v in dp.items(): s, l = parse(k) if s + 1 == l: ans += v ans %= mod print(ans)