# Atcoder Problem Solving
# Sum Equals Xor
L = input()
ans = 0
mod = 10**9+7
L = L[::-1]
N = len(L)
dp = [0 for i in range(N+10)]

if L[0] == "0":
    dp[0] = 1
else:
    dp[0] = 3
for i in range(1, N):
    if L[i] == "1":
        dp[i] = 2*dp[i-1]+pow(3, i, mod)
        dp[i] %= mod
    else:
        dp[i] = dp[i-1]
print(dp[N-1] % mod) L = input() L input() input ans = 0 ans 0 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 L = L[::-1] L L[::-1] L ::-1 -1 N = len(L) N len(L) len L 0 for i in range(N+10) for i in range(N+10) i range(N+10) range N+10 N 10 for i in range(N+10) 0 dp = [0 for i in range(N+10)] dp [0 for i in range(N+10)] if L[0] == "0":
    dp[0] = 1
else:
    dp[0] = 3 L[0] == "0" L[0] L 0 "0" dp[0] = 1 dp[0] dp 0 1 dp[0] = 3 dp[0] dp 0 3 for i in range(1, N):
    if L[i] == "1":
        dp[i] = 2*dp[i-1]+pow(3, i, mod)
        dp[i] %= mod
    else:
        dp[i] = dp[i-1] i range(1, N) range 1 N if L[i] == "1":
        dp[i] = 2*dp[i-1]+pow(3, i, mod)
        dp[i] %= mod
    else:
        dp[i] = dp[i-1] L[i] == "1" L[i] L i "1" dp[i] = 2*dp[i-1]+pow(3, i, mod) dp[i] dp i 2*dp[i-1]+pow(3, i, mod) 2*dp[i-1] 2 dp[i-1] dp i-1 i 1 pow(3, i, mod) pow 3 i mod dp[i] %= mod dp[i] dp i mod dp[i] = dp[i-1] dp[i] dp i dp[i-1] dp i-1 i 1 print(dp[N-1] % mod) print dp[N-1] % mod dp[N-1] dp N-1 N 1 mod L = L[::-1] L[::-1] L mod = 10**9+7 10**9+7 mod dp = [0 for i in range(N+10)] [0 for i in range(N+10)] dp L = input() input() L N = len(L) len(L) N ans = 0 0 ans
# Atcoder Problem Solving
# Sum Equals Xor
L = input()
ans = 0
mod = 10**9+7
L = L[::-1]
N = len(L)
dp = [0 for i in range(N+10)]

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