import sys

import numba as nb
import numpy as np

input = sys.stdin.readline
P = 10 ** 9 + 7


@nb.njit("i8(i8[:],i8)", cache=True)
def solve(L, N):
    dp = np.zeros(shape=(N + 1, 2), dtype=np.int64)
    dp[0][0] = 1
    for i in range(N):
        n = L[i]
        for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

        dp[i + 1][0] %= P
        dp[i + 1][1] %= P

    return (dp[N][0] + dp[N][1]) % P


def main():
    L = np.array(list(map(int, input().rstrip())), dtype=np.int64)

    N = len(L)
    ans = solve(L, N)

    print(ans)


if __name__ == "__main__":
    main() import sys sys import numba as nb numba import numpy as np numpy input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline P = 10 ** 9 + 7 P 10 ** 9 + 7 10 ** 9 10 9 7 def solve(L, N):
    dp = np.zeros(shape=(N + 1, 2), dtype=np.int64)
    dp[0][0] = 1
    for i in range(N):
        n = L[i]
        for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

        dp[i + 1][0] %= P
        dp[i + 1][1] %= P

    return (dp[N][0] + dp[N][1]) % P solve dp = np.zeros(shape=(N + 1, 2), dtype=np.int64) dp np.zeros(shape=(N + 1, 2), dtype=np.int64) np.zeros np zeros shape=(N + 1, 2) shape (N + 1, 2) N + 1 N 1 2 dtype=np.int64 dtype np.int64 np int64 dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(N):
        n = L[i]
        for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

        dp[i + 1][0] %= P
        dp[i + 1][1] %= P

     i range(N) range N n = L[i] n L[i] L i for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

         j range(2) range 2 max_d = 1 if j == 1 else n max_d 1 if j == 1 else n j == 1 j 1 1 n for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

         d range(max_d + 1) range max_d + 1 max_d 1 next_j = int(j or d < n) next_j int(j or d < n) int j or d < n j d < n d n dp[i + 1][next_j] += (d + 1) * dp[i][j] dp[i + 1][next_j] [i + 1] dp i + 1 i 1 next_j (d + 1) * dp[i][j] d + 1 d 1 dp[i][j] [i] dp i j dp[i + 1][0] %= P dp[i + 1][0] [i + 1] dp i + 1 i 1 0 P dp[i + 1][1] %= P dp[i + 1][1] [i + 1] dp i + 1 i 1 1 P return (dp[N][0] + dp[N][1]) % P (dp[N][0] + dp[N][1]) % P dp[N][0] + dp[N][1] dp[N][0] [N] dp N 0 dp[N][1] [N] dp N 1 P L L N N @nb.njit("i8(i8[:],i8)", cache=True) solve "i8(i8[:],i8)", cache=True @nb.njit("i8(i8[:],i8)", cache=True) nb.njit "i8(i8[:],i8)" cache=True cache True solve def main():
    L = np.array(list(map(int, input().rstrip())), dtype=np.int64)

    N = len(L)
    ans = solve(L, N)

    print(ans) main L = np.array(list(map(int, input().rstrip())), dtype=np.int64) L np.array(list(map(int, input().rstrip())), dtype=np.int64) np.array np array list(map(int, input().rstrip())) list map(int, input().rstrip()) map int input().rstrip() ().rstrip () input rstrip dtype=np.int64 dtype np.int64 np int64 N = len(L) N len(L) len L ans = solve(L, N) ans solve(L, N) solve L N print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def solve(L, N):
    dp = np.zeros(shape=(N + 1, 2), dtype=np.int64)
    dp[0][0] = 1
    for i in range(N):
        n = L[i]
        for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

        dp[i + 1][0] %= P
        dp[i + 1][1] %= P

    return (dp[N][0] + dp[N][1]) % P def solve(L, N):
    dp = np.zeros(shape=(N + 1, 2), dtype=np.int64)
    dp[0][0] = 1
    for i in range(N):
        n = L[i]
        for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

        dp[i + 1][0] %= P
        dp[i + 1][1] %= P

    return (dp[N][0] + dp[N][1]) % P solve input = sys.stdin.readline sys.stdin.readline input def main():
    L = np.array(list(map(int, input().rstrip())), dtype=np.int64)

    N = len(L)
    ans = solve(L, N)

    print(ans) def main():
    L = np.array(list(map(int, input().rstrip())), dtype=np.int64)

    N = len(L)
    ans = solve(L, N)

    print(ans) main P = 10 ** 9 + 7 10 ** 9 + 7 P
import sys

import numba as nb
import numpy as np

input = sys.stdin.readline
P = 10 ** 9 + 7


@nb.njit("i8(i8[:],i8)", cache=True)
def solve(L, N):
    dp = np.zeros(shape=(N + 1, 2), dtype=np.int64)
    dp[0][0] = 1
    for i in range(N):
        n = L[i]
        for j in range(2):
            max_d = 1 if j == 1 else n
            for d in range(max_d + 1):
                next_j = int(j or d < n)
                dp[i + 1][next_j] += (d + 1) * dp[i][j]

        dp[i + 1][0] %= P
        dp[i + 1][1] %= P

    return (dp[N][0] + dp[N][1]) % P


def main():
    L = np.array(list(map(int, input().rstrip())), dtype=np.int64)

    N = len(L)
    ans = solve(L, N)

    print(ans)


if __name__ == "__main__":
    main()
