# coding: utf-8
# Your code here!
L=input()

N=len(L)

dp=[[0 for i in range(2)] for j in range(N)]
dp[0][0]=1
dp[0][1]=2
#print(dp)

mod=10**9+7
for i in range(N-1):
    dp[i+1][0]=(3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]))%mod
    dp[i+1][1]=(dp[i][1] if L[i+1]=="0" else 2*dp[i][1])%mod


#print(dp)
print((dp[-1][0]+dp[-1][1])%mod)
 L=input() L input() input N=len(L) N len(L) len L [0 for i in range(2)] for j in range(N) for j in range(N) j range(N) range N for j in range(N) [0 for i in range(2)] dp=[[0 for i in range(2)] for j in range(N)] dp [[0 for i in range(2)] for j in range(N)] dp[0][0]=1 dp[0][0] [0] dp 0 0 1 dp[0][1]=2 dp[0][1] [0] dp 0 1 2 mod=10**9+7 mod 10**9+7 10**9 10 9 7 for i in range(N-1):
    dp[i+1][0]=(3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]))%mod
    dp[i+1][1]=(dp[i][1] if L[i+1]=="0" else 2*dp[i][1])%mod


#print(dp) i range(N-1) range N-1 N 1 dp[i+1][0]=(3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]))%mod dp[i+1][0] [i+1] dp i+1 i 1 0 (3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]))%mod 3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]) 3*dp[i][0] 3 dp[i][0] [i] dp i 0 0 if L[i+1]=="0" else dp[i][1] L[i+1]=="0" L[i+1] L i+1 i 1 "0" 0 dp[i][1] [i] dp i 1 mod dp[i+1][1]=(dp[i][1] if L[i+1]=="0" else 2*dp[i][1])%mod dp[i+1][1] [i+1] dp i+1 i 1 1 (dp[i][1] if L[i+1]=="0" else 2*dp[i][1])%mod dp[i][1] if L[i+1]=="0" else 2*dp[i][1] L[i+1]=="0" L[i+1] L i+1 i 1 "0" dp[i][1] [i] dp i 1 2*dp[i][1] 2 dp[i][1] [i] dp i 1 mod print((dp[-1][0]+dp[-1][1])%mod) print (dp[-1][0]+dp[-1][1])%mod dp[-1][0]+dp[-1][1] dp[-1][0] [-1] dp -1 0 dp[-1][1] [-1] dp -1 1 mod N=len(L) len(L) N L=input() input() L mod=10**9+7 10**9+7 mod dp=[[0 for i in range(2)] for j in range(N)] [[0 for i in range(2)] for j in range(N)] dp
# coding: utf-8
# Your code here!
L=input()

N=len(L)

dp=[[0 for i in range(2)] for j in range(N)]
dp[0][0]=1
dp[0][1]=2
#print(dp)

mod=10**9+7
for i in range(N-1):
    dp[i+1][0]=(3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]))%mod
    dp[i+1][1]=(dp[i][1] if L[i+1]=="0" else 2*dp[i][1])%mod


#print(dp)
print((dp[-1][0]+dp[-1][1])%mod)

