L=input()
mod=10**9+7



N=[int(i) for i in L]
keta=len(N)
dp=[[0 for i in range(2)] for j in range(keta+1)]
dp[0][0] = 1
#dp[0][0][1] =0
#dp[0][1][0] =0
#dp[0][1][1] =0

for i in range(keta):
    for smaller in [0,1]:
        if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod
print((dp[keta][0]+ dp[keta][1])%mod) L=input() L input() input mod=10**9+7 mod 10**9+7 10**9 10 9 7 int(i) for i in L for i in L i L for i in L int(i) int i N=[int(i) for i in L] N [int(i) for i in L] keta=len(N) keta len(N) len N [0 for i in range(2)] for j in range(keta+1) for j in range(keta+1) j range(keta+1) range keta+1 keta 1 for j in range(keta+1) [0 for i in range(2)] dp=[[0 for i in range(2)] for j in range(keta+1)] dp [[0 for i in range(2)] for j in range(keta+1)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(keta):
    for smaller in [0,1]:
        if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod i range(keta) range keta for smaller in [0,1]:
        if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod smaller [0,1] 0 1 if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod 1 for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod x range(2 if smaller else (N[i]+1)) range 2 if smaller else (N[i]+1) smaller 2 N[i]+1 N[i] N i 1 dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1) dp[i + 1][smaller | ((x == 0)&(N[i]==1))] [i + 1] dp i + 1 i 1 smaller | ((x == 0)&(N[i]==1)) smaller (x == 0)&(N[i]==1) x == 0 x 0 N[i]==1 N[i] N i 1 dp[i][smaller]*(2 if x==1 else 1) dp[i][smaller] [i] dp i smaller 2 if x==1 else 1 x==1 x 1 2 1 dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod dp[i + 1][smaller | ((x == 0)&(N[i]==1))] [i + 1] dp i + 1 i 1 smaller | ((x == 0)&(N[i]==1)) smaller (x == 0)&(N[i]==1) x == 0 x 0 N[i]==1 N[i] N i 1 mod print((dp[keta][0]+ dp[keta][1])%mod) print (dp[keta][0]+ dp[keta][1])%mod dp[keta][0]+ dp[keta][1] dp[keta][0] [keta] dp keta 0 dp[keta][1] [keta] dp keta 1 mod L=input() input() L keta=len(N) len(N) keta N=[int(i) for i in L] [int(i) for i in L] N mod=10**9+7 10**9+7 mod dp=[[0 for i in range(2)] for j in range(keta+1)] [[0 for i in range(2)] for j in range(keta+1)] dp
L=input()
mod=10**9+7



N=[int(i) for i in L]
keta=len(N)
dp=[[0 for i in range(2)] for j in range(keta+1)]
dp[0][0] = 1
#dp[0][0][1] =0
#dp[0][1][0] =0
#dp[0][1][1] =0

for i in range(keta):
    for smaller in [0,1]:
        if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod
print((dp[keta][0]+ dp[keta][1])%mod)
