#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    l = list(map(int, input()))
    n = len(l)
    dp = [[0]*2 for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        ni = i+1
        for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
    print(sum(dp[n])%mod)
    return

#Solve
if __name__ == "__main__":
    solve() from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys sys import math math import bisect bisect int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def I(): return int(sys.stdin.readline()) I list(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() list(x) list x def LS():return [list(x) for x in sys.stdin.readline().split()] LS def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res S res = list(sys.stdin.readline()) res list(sys.stdin.readline()) list sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline if res[-1] == "\n":
        return res[:-1]
     res[-1] == "\n" res[-1] res -1 "\n" return res[:-1] res[:-1] res :-1 -1 return res res def IR(n):
    return [I() for i in range(n)] IR I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I return [I() for i in range(n)] [I() for i in range(n)] n n def LIR(n):
    return [LI() for i in range(n)] LIR LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI return [LI() for i in range(n)] [LI() for i in range(n)] n n def SR(n):
    return [S() for i in range(n)] SR S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S return [S() for i in range(n)] [S() for i in range(n)] n n def LSR(n):
    return [LS() for i in range(n)] LSR LS() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LS() LS return [LS() for i in range(n)] [LS() for i in range(n)] n n sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 mod = 1000000007 mod 1000000007 def solve():
    l = list(map(int, input()))
    n = len(l)
    dp = [[0]*2 for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        ni = i+1
        for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
    print(sum(dp[n])%mod)
    return

#Solve solve l = list(map(int, input())) l list(map(int, input())) list map(int, input()) map int input() input n = len(l) n len(l) len l [0]*2 for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) [0]*2 [0] 0 2 dp = [[0]*2 for i in range(n+1)] dp [[0]*2 for i in range(n+1)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(n):
        ni = i+1
        for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
     i range(n) range n ni = i+1 ni i+1 i 1 for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
     j range(2) range 2 x = 1 if j else l[i] x 1 if j else l[i] j 1 l[i] l i for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
     d range(x+1) range x+1 x 1 nj = j or d < l[i] nj j or d < l[i] j d < l[i] d l[i] l i if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                 d dp[ni][nj] += 2*dp[i][j] dp[ni][nj] [ni] dp ni nj 2*dp[i][j] 2 dp[i][j] [i] dp i j dp[ni][nj] += dp[i][j] dp[ni][nj] [ni] dp ni nj dp[i][j] [i] dp i j dp[ni][nj] %= mod dp[ni][nj] [ni] dp ni nj mod print(sum(dp[n])%mod) print sum(dp[n])%mod sum(dp[n]) sum dp[n] dp n mod return if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def LIR(n):
    return [LI() for i in range(n)] def LIR(n):
    return [LI() for i in range(n)] LIR def LS():return [list(x) for x in sys.stdin.readline().split()] def LS():return [list(x) for x in sys.stdin.readline().split()] LS def IR(n):
    return [I() for i in range(n)] def IR(n):
    return [I() for i in range(n)] IR def LSR(n):
    return [LS() for i in range(n)] def LSR(n):
    return [LS() for i in range(n)] LSR mod = 1000000007 1000000007 mod def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res S def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def solve():
    l = list(map(int, input()))
    n = len(l)
    dp = [[0]*2 for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        ni = i+1
        for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
    print(sum(dp[n])%mod)
    return

#Solve def solve():
    l = list(map(int, input()))
    n = len(l)
    dp = [[0]*2 for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        ni = i+1
        for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
    print(sum(dp[n])%mod)
    return

#Solve solve def SR(n):
    return [S() for i in range(n)] def SR(n):
    return [S() for i in range(n)] SR
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    l = list(map(int, input()))
    n = len(l)
    dp = [[0]*2 for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        ni = i+1
        for j in range(2):
            x = 1 if j else l[i]
            for d in range(x+1):
                nj = j or d < l[i]
                if d:
                    dp[ni][nj] += 2*dp[i][j]
                else:
                    dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= mod
    print(sum(dp[n])%mod)
    return

#Solve
if __name__ == "__main__":
    solve()
