N = list(map(int, input())) D = len(N) M = 100 now = [0] * (2*M) now[0] = 1 for i, n in enumerate(N): nxt = [0] * (2*M) for smaller in range(2): for j in range(M): if not now[smaller*M+j]: continue for x in range(10 if smaller else n + 1): if j*10+x == 404: continue nxt[(smaller or x < n)*M+(j*10+x)%M] += now[smaller*M+j] now = nxt print((sum(now) - 1) % 998244353)