#129_E
l = input()
x = len(l)
mod = 10 ** 9 + 7

dp = [[0 for _ in range(2)] for _ in range(x)]
dp[0][1] = 2
dp[0][0] = 1
for i in range(1, x):
    if l[i] == '0':
        dp[i][1] = (dp[i][1] + dp[i-1][1]) % mod
    else:
        dp[i][1] = (dp[i][1] + dp[i-1][1] * 2) % mod
        dp[i][0] = (dp[i][0] + dp[i-1][1]) % mod
        
    dp[i][0] = (dp[i][0] + dp[i-1][0] * 3) % mod
print((dp[x-1][0] + dp[x-1][1]) % mod) l = input() l input() input x = len(l) x len(l) len l mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 [0 for _ in range(2)] for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) [0 for _ in range(2)] dp = [[0 for _ in range(2)] for _ in range(x)] dp [[0 for _ in range(2)] for _ in range(x)] dp[0][1] = 2 dp[0][1] [0] dp 0 1 2 dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(1, x):
    if l[i] == '0':
        dp[i][1] = (dp[i][1] + dp[i-1][1]) % mod
    else:
        dp[i][1] = (dp[i][1] + dp[i-1][1] * 2) % mod
        dp[i][0] = (dp[i][0] + dp[i-1][1]) % mod
        
    dp[i][0] = (dp[i][0] + dp[i-1][0] * 3) % mod i range(1, x) range 1 x if l[i] == '0':
        dp[i][1] = (dp[i][1] + dp[i-1][1]) % mod
    else:
        dp[i][1] = (dp[i][1] + dp[i-1][1] * 2) % mod
        dp[i][0] = (dp[i][0] + dp[i-1][1]) % mod
        
     l[i] == '0' l[i] l i '0' dp[i][1] = (dp[i][1] + dp[i-1][1]) % mod dp[i][1] [i] dp i 1 (dp[i][1] + dp[i-1][1]) % mod dp[i][1] + dp[i-1][1] dp[i][1] [i] dp i 1 dp[i-1][1] [i-1] dp i-1 i 1 1 mod dp[i][1] = (dp[i][1] + dp[i-1][1] * 2) % mod dp[i][1] [i] dp i 1 (dp[i][1] + dp[i-1][1] * 2) % mod dp[i][1] + dp[i-1][1] * 2 dp[i][1] [i] dp i 1 dp[i-1][1] * 2 dp[i-1][1] [i-1] dp i-1 i 1 1 2 mod dp[i][0] = (dp[i][0] + dp[i-1][1]) % mod dp[i][0] [i] dp i 0 (dp[i][0] + dp[i-1][1]) % mod dp[i][0] + dp[i-1][1] dp[i][0] [i] dp i 0 dp[i-1][1] [i-1] dp i-1 i 1 1 mod dp[i][0] = (dp[i][0] + dp[i-1][0] * 3) % mod dp[i][0] [i] dp i 0 (dp[i][0] + dp[i-1][0] * 3) % mod dp[i][0] + dp[i-1][0] * 3 dp[i][0] [i] dp i 0 dp[i-1][0] * 3 dp[i-1][0] [i-1] dp i-1 i 1 0 3 mod print((dp[x-1][0] + dp[x-1][1]) % mod) print (dp[x-1][0] + dp[x-1][1]) % mod dp[x-1][0] + dp[x-1][1] dp[x-1][0] [x-1] dp x-1 x 1 0 dp[x-1][1] [x-1] dp x-1 x 1 1 mod l = input() input() l dp = [[0 for _ in range(2)] for _ in range(x)] [[0 for _ in range(2)] for _ in range(x)] dp x = len(l) len(l) x mod = 10 ** 9 + 7 10 ** 9 + 7 mod
#129_E
l = input()
x = len(l)
mod = 10 ** 9 + 7

dp = [[0 for _ in range(2)] for _ in range(x)]
dp[0][1] = 2
dp[0][0] = 1
for i in range(1, x):
    if l[i] == '0':
        dp[i][1] = (dp[i][1] + dp[i-1][1]) % mod
    else:
        dp[i][1] = (dp[i][1] + dp[i-1][1] * 2) % mod
        dp[i][0] = (dp[i][0] + dp[i-1][1]) % mod
        
    dp[i][0] = (dp[i][0] + dp[i-1][0] * 3) % mod
print((dp[x-1][0] + dp[x-1][1]) % mod)