l = [int(i) for i in input()]
n = len(l)
mod = 10**9+7
memo = [1]*(n+2)
cnt  = [1]*(n+2)
for i in range(1,n+1):
    if l[i-1] == 0:
        memo[i] = memo[i-1]
    else:
        memo[i] = memo[i-1]*2
    memo[i] %= mod
for i in range(n,0,-1):
    cnt[i] = (cnt[i+1]*3)%mod

ans = memo[n]
for i in range(n,0,-1):
    if l[i-1] == 0:
        continue
    ans += memo[i-1]*cnt[i+1]
    ans %= mod
print(ans) int(i) for i in input() for i in input() i input() input for i in input() int(i) int i l = [int(i) for i in input()] l [int(i) for i in input()] n = len(l) n len(l) len l mod = 10**9+7 mod 10**9+7 10**9 10 9 7 memo = [1]*(n+2) memo [1]*(n+2) [1] 1 n+2 n 2 cnt  = [1]*(n+2) cnt [1]*(n+2) [1] 1 n+2 n 2 for i in range(1,n+1):
    if l[i-1] == 0:
        memo[i] = memo[i-1]
    else:
        memo[i] = memo[i-1]*2
    memo[i] %= mod i range(1,n+1) range 1 n+1 n 1 if l[i-1] == 0:
        memo[i] = memo[i-1]
    else:
        memo[i] = memo[i-1]*2
     l[i-1] == 0 l[i-1] l i-1 i 1 0 memo[i] = memo[i-1] memo[i] memo i memo[i-1] memo i-1 i 1 memo[i] = memo[i-1]*2 memo[i] memo i memo[i-1]*2 memo[i-1] memo i-1 i 1 2 memo[i] %= mod memo[i] memo i mod for i in range(n,0,-1):
    cnt[i] = (cnt[i+1]*3)%mod i range(n,0,-1) range n 0 -1 cnt[i] = (cnt[i+1]*3)%mod cnt[i] cnt i (cnt[i+1]*3)%mod cnt[i+1]*3 cnt[i+1] cnt i+1 i 1 3 mod ans = memo[n] ans memo[n] memo n for i in range(n,0,-1):
    if l[i-1] == 0:
        continue
    ans += memo[i-1]*cnt[i+1]
    ans %= mod i range(n,0,-1) range n 0 -1 if l[i-1] == 0:
        continue
     l[i-1] == 0 l[i-1] l i-1 i 1 0 continue ans += memo[i-1]*cnt[i+1] ans memo[i-1]*cnt[i+1] memo[i-1] memo i-1 i 1 cnt[i+1] cnt i+1 i 1 ans %= mod ans mod print(ans) print ans ans += memo[i-1]*cnt[i+1] memo[i-1]*cnt[i+1] ans ans %= mod mod ans n = len(l) len(l) n memo = [1]*(n+2) [1]*(n+2) memo l = [int(i) for i in input()] [int(i) for i in input()] l ans = memo[n] memo[n] ans cnt  = [1]*(n+2) [1]*(n+2) cnt mod = 10**9+7 10**9+7 mod
l = [int(i) for i in input()]
n = len(l)
mod = 10**9+7
memo = [1]*(n+2)
cnt  = [1]*(n+2)
for i in range(1,n+1):
    if l[i-1] == 0:
        memo[i] = memo[i-1]
    else:
        memo[i] = memo[i-1]*2
    memo[i] %= mod
for i in range(n,0,-1):
    cnt[i] = (cnt[i+1]*3)%mod

ans = memo[n]
for i in range(n,0,-1):
    if l[i-1] == 0:
        continue
    ans += memo[i-1]*cnt[i+1]
    ans %= mod
print(ans)