mod = 10 ** 9 + 7 S = input() N = len(S) dp = [[[0] * 2 for _ in range(10)] for _ in range(N + 1)] dp[0][0][0] = 1 for i, s in enumerate(S): nd = int(s) for j in range(10): for k in range(2): for d in range(10): ni = i + 1 nj = d nk = k if nk == 0: if d > nd: continue if d < nd: nk = 1 dp[ni][nj][nk] += dp[i][j][k] * d dp[ni][nj][nk] %= mod ans = 0 for i in range(10): for j in range(2): ans += dp[N][i][j] ans %= mod add = 45 for i in range(N - 1): ans += add ans %= mod add *= 45 add %= mod print(ans)