s=list(str(input()))
for i in range(len(s)):
    s[i]=int(s[i])
n=len(s)
mod=10**9+7
dp=[[0 for i in range(2)] for j in range(n+1)]
dp[0][0]=0
dp[0][1]=1
for i in range(n):
    if s[i]==1:
        dp[i+1][0]=(dp[i][0]*3+dp[i][1])%mod
        dp[i+1][1]=dp[i][1]*2%mod
    else:
        dp[i+1][0]=dp[i][0]*3%mod
        dp[i+1][1]=dp[i][1]%mod
print(sum(dp[n])%mod) s=list(str(input())) s list(str(input())) list str(input()) str input() input for i in range(len(s)):
    s[i]=int(s[i]) i range(len(s)) range len(s) len s s[i]=int(s[i]) s[i] s i int(s[i]) int s[i] s i n=len(s) n len(s) len s mod=10**9+7 mod 10**9+7 10**9 10 9 7 [0 for i in range(2)] for j in range(n+1) for j in range(n+1) j range(n+1) range n+1 n 1 for j in range(n+1) [0 for i in range(2)] dp=[[0 for i in range(2)] for j in range(n+1)] dp [[0 for i in range(2)] for j in range(n+1)] dp[0][0]=0 dp[0][0] [0] dp 0 0 0 dp[0][1]=1 dp[0][1] [0] dp 0 1 1 for i in range(n):
    if s[i]==1:
        dp[i+1][0]=(dp[i][0]*3+dp[i][1])%mod
        dp[i+1][1]=dp[i][1]*2%mod
    else:
        dp[i+1][0]=dp[i][0]*3%mod
        dp[i+1][1]=dp[i][1]%mod i range(n) range n if s[i]==1:
        dp[i+1][0]=(dp[i][0]*3+dp[i][1])%mod
        dp[i+1][1]=dp[i][1]*2%mod
    else:
        dp[i+1][0]=dp[i][0]*3%mod
        dp[i+1][1]=dp[i][1]%mod s[i]==1 s[i] s i 1 dp[i+1][0]=(dp[i][0]*3+dp[i][1])%mod dp[i+1][0] [i+1] dp i+1 i 1 0 (dp[i][0]*3+dp[i][1])%mod dp[i][0]*3+dp[i][1] dp[i][0]*3 dp[i][0] [i] dp i 0 3 dp[i][1] [i] dp i 1 mod dp[i+1][1]=dp[i][1]*2%mod dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][1]*2%mod dp[i][1]*2 dp[i][1] [i] dp i 1 2 mod dp[i+1][0]=dp[i][0]*3%mod dp[i+1][0] [i+1] dp i+1 i 1 0 dp[i][0]*3%mod dp[i][0]*3 dp[i][0] [i] dp i 0 3 mod dp[i+1][1]=dp[i][1]%mod dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][1]%mod dp[i][1] [i] dp i 1 mod print(sum(dp[n])%mod) print sum(dp[n])%mod sum(dp[n]) sum dp[n] dp n mod dp=[[0 for i in range(2)] for j in range(n+1)] [[0 for i in range(2)] for j in range(n+1)] dp s=list(str(input())) list(str(input())) s mod=10**9+7 10**9+7 mod n=len(s) len(s) n
s=list(str(input()))
for i in range(len(s)):
    s[i]=int(s[i])
n=len(s)
mod=10**9+7
dp=[[0 for i in range(2)] for j in range(n+1)]
dp[0][0]=0
dp[0][1]=1
for i in range(n):
    if s[i]==1:
        dp[i+1][0]=(dp[i][0]*3+dp[i][1])%mod
        dp[i+1][1]=dp[i][1]*2%mod
    else:
        dp[i+1][0]=dp[i][0]*3%mod
        dp[i+1][1]=dp[i][1]%mod
print(sum(dp[n])%mod)