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

eq = 1
less = 0
for n in L:
    if n == '1':
        eq, less = eq * 2, eq + less * 3
    else:
        less = less * 3
    eq %= MOD
    less %= MOD

print((eq + less) % MOD) L = input() L input() input MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 eq = 1 eq 1 less = 0 less 0 for n in L:
    if n == '1':
        eq, less = eq * 2, eq + less * 3
    else:
        less = less * 3
    eq %= MOD
    less %= MOD n L if n == '1':
        eq, less = eq * 2, eq + less * 3
    else:
        less = less * 3
     n == '1' n '1' eq, less = eq * 2, eq + less * 3 eq eq * 2 eq 2 less eq + less * 3 eq less * 3 less 3 less = less * 3 less less * 3 less 3 eq %= MOD eq MOD less %= MOD less MOD print((eq + less) % MOD) print (eq + less) % MOD eq + less eq less MOD eq = 1 1 eq eq, less = eq * 2, eq + less * 3 eq * 2 eq less %= MOD MOD less less = eq * 2, eq + less * 3 eq + less * 3 less eq %= MOD MOD eq MOD = 10**9 + 7 10**9 + 7 MOD less = 0 0 less L = input() input() L less = less * 3 less * 3 less
L = input()
MOD = 10**9 + 7

eq = 1
less = 0
for n in L:
    if n == '1':
        eq, less = eq * 2, eq + less * 3
    else:
        less = less * 3
    eq %= MOD
    less %= MOD

print((eq + less) % MOD)
