L = input()
N = len(L)
MOD = 10**9+7
dp = [[0]*2 for _ in range(101010)]
dp[0][0] = 1
for i in range(N):
    dp[i+1][1] += 3*dp[i][1]
    dp[i + 1][1] %= MOD
    if L[i] == '1':
        dp[i+1][0] += 2*dp[i][0]  # (a,b) = (0,1),(1,0)
        dp[i + 1][0] %= MOD
        dp[i+1][1] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][1] %= MOD
    else:
        dp[i+1][0] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][0] %= MOD
ans = (dp[N][0] + dp[N][1])%MOD
print(ans) L = input() L input() input N = len(L) N len(L) len L MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 [0]*2 for _ in range(101010) for _ in range(101010) _ range(101010) range 101010 for _ in range(101010) [0]*2 [0] 0 2 dp = [[0]*2 for _ in range(101010)] dp [[0]*2 for _ in range(101010)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(N):
    dp[i+1][1] += 3*dp[i][1]
    dp[i + 1][1] %= MOD
    if L[i] == '1':
        dp[i+1][0] += 2*dp[i][0]  # (a,b) = (0,1),(1,0)
        dp[i + 1][0] %= MOD
        dp[i+1][1] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][1] %= MOD
    else:
        dp[i+1][0] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][0] %= MOD i range(N) range N dp[i+1][1] += 3*dp[i][1] dp[i+1][1] [i+1] dp i+1 i 1 1 3*dp[i][1] 3 dp[i][1] [i] dp i 1 dp[i + 1][1] %= MOD dp[i + 1][1] [i + 1] dp i + 1 i 1 1 MOD if L[i] == '1':
        dp[i+1][0] += 2*dp[i][0]  # (a,b) = (0,1),(1,0)
        dp[i + 1][0] %= MOD
        dp[i+1][1] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][1] %= MOD
    else:
        dp[i+1][0] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][0] %= MOD L[i] == '1' L[i] L i '1' dp[i+1][0] += 2*dp[i][0] dp[i+1][0] [i+1] dp i+1 i 1 0 2*dp[i][0] 2 dp[i][0] [i] dp i 0 dp[i + 1][0] %= MOD dp[i + 1][0] [i + 1] dp i + 1 i 1 0 MOD dp[i+1][1] += dp[i][0] dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][0] [i] dp i 0 dp[i + 1][1] %= MOD dp[i + 1][1] [i + 1] dp i + 1 i 1 1 MOD dp[i+1][0] += dp[i][0] dp[i+1][0] [i+1] dp i+1 i 1 0 dp[i][0] [i] dp i 0 dp[i + 1][0] %= MOD dp[i + 1][0] [i + 1] dp i + 1 i 1 0 MOD ans = (dp[N][0] + dp[N][1])%MOD ans (dp[N][0] + dp[N][1])%MOD dp[N][0] + dp[N][1] dp[N][0] [N] dp N 0 dp[N][1] [N] dp N 1 MOD print(ans) print ans dp = [[0]*2 for _ in range(101010)] [[0]*2 for _ in range(101010)] dp ans = (dp[N][0] + dp[N][1])%MOD (dp[N][0] + dp[N][1])%MOD ans L = input() input() L MOD = 10**9+7 10**9+7 MOD N = len(L) len(L) N
L = input()
N = len(L)
MOD = 10**9+7
dp = [[0]*2 for _ in range(101010)]
dp[0][0] = 1
for i in range(N):
    dp[i+1][1] += 3*dp[i][1]
    dp[i + 1][1] %= MOD
    if L[i] == '1':
        dp[i+1][0] += 2*dp[i][0]  # (a,b) = (0,1),(1,0)
        dp[i + 1][0] %= MOD
        dp[i+1][1] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][1] %= MOD
    else:
        dp[i+1][0] += dp[i][0]  # (a,b) = (0,0)
        dp[i + 1][0] %= MOD
ans = (dp[N][0] + dp[N][1])%MOD
print(ans)