import typing def z_algorithm(s: typing.Union[str, typing.List[int]]) -> typing.List[int]: ''' Z algorithm Reference: D. Gusfield, Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology ''' if isinstance(s, str): s = [ord(c) for c in s] n = len(s) if n == 0: return [] z = [0] * n j = 0 for i in range(1, n): z[i] = 0 if j + z[j] <= i else min(j + z[j] - i, z[i - j]) while i + z[i] < n and s[z[i]] == s[i + z[i]]: z[i] += 1 if j + z[j] < i + z[i]: j = i z[0] = n return z MOD=998244353 s=input() n=len(s) z=z_algorithm(s) ans=MOD-n+1 p=10 for i in range(1,n+1): if z[n-i]==i: ans+=p ans%=MOD p*=10 p%=MOD print(ans)