import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] # inf = 18446744073709551615 inf = 4294967295 md = 10**9+7 # md = 998244353 md1 = 10**9 s = list(map(int, SI())) n = len(s) for m in [md1, md]: def ok(): for i in range(n//2, -1, -1): if s[i] < s[n-1-i]: return True if s[i] > s[n-1-i]: return False return True ans = 0 cc = [0] for k in range(1, n): if k == 1: c = 9 elif k & 1: c = cc[k-1]*10%m else: c = cc[k-1] cc.append(c) for c in cc: ans = (ans+c)%m if s[0] and s[-1]: n2 = (n+1)//2 dp = [[0]*2 for _ in range(n2+1)] dp[0][0] = 1 for i, a in enumerate(s[:n2]): dp[i+1][0] = dp[i][0] if i: dp[i+1][1] = (dp[i][1]*10+dp[i][0]*a)%m else: dp[i+1][1] = min(a-1, s[n-1-i]) ans += dp[-1][1] if ok(): ans += 1 print(ans%m)