L   = list(input())
dp  = [[0 for _ in range(2)] for _ in range(100005)]
MOD = 10**9+7

dp[0][0] = 1

for i,l in enumerate(L,1):
  if l=='1':
    dp[i][0] = dp[i-1][0]*2 % MOD
    dp[i][1] = (dp[i-1][0] + dp[i-1][1]*3) % MOD
  else:
    dp[i][0] = dp[i-1][0]
    dp[i][1] = dp[i-1][1]*3 % MOD

print((dp[i][0] + dp[i][1]) % MOD) L   = list(input()) L list(input()) list input() input [0 for _ in range(2)] for _ in range(100005) for _ in range(100005) _ range(100005) range 100005 for _ in range(100005) [0 for _ in range(2)] dp  = [[0 for _ in range(2)] for _ in range(100005)] dp [[0 for _ in range(2)] for _ in range(100005)] MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i,l in enumerate(L,1):
  if l=='1':
    dp[i][0] = dp[i-1][0]*2 % MOD
    dp[i][1] = (dp[i-1][0] + dp[i-1][1]*3) % MOD
  else:
    dp[i][0] = dp[i-1][0]
    dp[i][1] = dp[i-1][1]*3 % MOD i l enumerate(L,1) enumerate L 1 if l=='1':
    dp[i][0] = dp[i-1][0]*2 % MOD
    dp[i][1] = (dp[i-1][0] + dp[i-1][1]*3) % MOD
  else:
    dp[i][0] = dp[i-1][0]
    dp[i][1] = dp[i-1][1]*3 % MOD l=='1' l '1' dp[i][0] = dp[i-1][0]*2 % MOD dp[i][0] [i] dp i 0 dp[i-1][0]*2 % MOD dp[i-1][0]*2 dp[i-1][0] [i-1] dp i-1 i 1 0 2 MOD dp[i][1] = (dp[i-1][0] + dp[i-1][1]*3) % MOD dp[i][1] [i] dp i 1 (dp[i-1][0] + dp[i-1][1]*3) % MOD dp[i-1][0] + dp[i-1][1]*3 dp[i-1][0] [i-1] dp i-1 i 1 0 dp[i-1][1]*3 dp[i-1][1] [i-1] dp i-1 i 1 1 3 MOD dp[i][0] = dp[i-1][0] dp[i][0] [i] dp i 0 dp[i-1][0] [i-1] dp i-1 i 1 0 dp[i][1] = dp[i-1][1]*3 % MOD dp[i][1] [i] dp i 1 dp[i-1][1]*3 % MOD dp[i-1][1]*3 dp[i-1][1] [i-1] dp i-1 i 1 1 3 MOD print((dp[i][0] + dp[i][1]) % MOD) print (dp[i][0] + dp[i][1]) % MOD dp[i][0] + dp[i][1] dp[i][0] [i] dp i 0 dp[i][1] [i] dp i 1 MOD dp  = [[0 for _ in range(2)] for _ in range(100005)] [[0 for _ in range(2)] for _ in range(100005)] dp MOD = 10**9+7 10**9+7 MOD L   = list(input()) list(input()) L
L   = list(input())
dp  = [[0 for _ in range(2)] for _ in range(100005)]
MOD = 10**9+7

dp[0][0] = 1

for i,l in enumerate(L,1):
  if l=='1':
    dp[i][0] = dp[i-1][0]*2 % MOD
    dp[i][1] = (dp[i-1][0] + dp[i-1][1]*3) % MOD
  else:
    dp[i][0] = dp[i-1][0]
    dp[i][1] = dp[i-1][1]*3 % MOD

print((dp[i][0] + dp[i][1]) % MOD)