L = input()
N = len(L)
MOD = 10**9 + 7

dpAll = [0] * (N + 1)
dpLess = [0] * (N + 1)

dpAll[0] = 1
dpLess[0] = 1

for d, b in enumerate(L[:: -1], start=1):
    dpAll[d] = dpAll[d - 1] * 3
    if b == '1':
        dpLess[d] = dpLess[d - 1] * 2 + dpAll[d - 1]
    else:
        dpLess[d] = dpLess[d - 1]
    dpAll[d] %= MOD
    dpLess[d] %= MOD

print(dpLess[N] % MOD) 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 dpAll = [0] * (N + 1) dpAll [0] * (N + 1) [0] 0 N + 1 N 1 dpLess = [0] * (N + 1) dpLess [0] * (N + 1) [0] 0 N + 1 N 1 dpAll[0] = 1 dpAll[0] dpAll 0 1 dpLess[0] = 1 dpLess[0] dpLess 0 1 for d, b in enumerate(L[:: -1], start=1):
    dpAll[d] = dpAll[d - 1] * 3
    if b == '1':
        dpLess[d] = dpLess[d - 1] * 2 + dpAll[d - 1]
    else:
        dpLess[d] = dpLess[d - 1]
    dpAll[d] %= MOD
    dpLess[d] %= MOD d b enumerate(L[:: -1], start=1) enumerate L[:: -1] L :: -1 -1 start=1 start 1 dpAll[d] = dpAll[d - 1] * 3 dpAll[d] dpAll d dpAll[d - 1] * 3 dpAll[d - 1] dpAll d - 1 d 1 3 if b == '1':
        dpLess[d] = dpLess[d - 1] * 2 + dpAll[d - 1]
    else:
        dpLess[d] = dpLess[d - 1]
     b == '1' b '1' dpLess[d] = dpLess[d - 1] * 2 + dpAll[d - 1] dpLess[d] dpLess d dpLess[d - 1] * 2 + dpAll[d - 1] dpLess[d - 1] * 2 dpLess[d - 1] dpLess d - 1 d 1 2 dpAll[d - 1] dpAll d - 1 d 1 dpLess[d] = dpLess[d - 1] dpLess[d] dpLess d dpLess[d - 1] dpLess d - 1 d 1 dpAll[d] %= MOD dpAll[d] dpAll d MOD dpLess[d] %= MOD dpLess[d] dpLess d MOD print(dpLess[N] % MOD) print dpLess[N] % MOD dpLess[N] dpLess N MOD dpLess = [0] * (N + 1) [0] * (N + 1) dpLess dpAll = [0] * (N + 1) [0] * (N + 1) dpAll 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

dpAll = [0] * (N + 1)
dpLess = [0] * (N + 1)

dpAll[0] = 1
dpLess[0] = 1

for d, b in enumerate(L[:: -1], start=1):
    dpAll[d] = dpAll[d - 1] * 3
    if b == '1':
        dpLess[d] = dpLess[d - 1] * 2 + dpAll[d - 1]
    else:
        dpLess[d] = dpLess[d - 1]
    dpAll[d] %= MOD
    dpLess[d] %= MOD

print(dpLess[N] % MOD)