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

eqDp = 1
lessDp = 0

for l in L:
    if l == '1':
        eqDp, lessDp = eqDp * 2, lessDp * 3 + eqDp
    else:
        eqDp, lessDp = eqDp, lessDp * 3

    eqDp %= MOD
    lessDp %= MOD

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

    eqDp %= MOD
    lessDp %= MOD l L if l == '1':
        eqDp, lessDp = eqDp * 2, lessDp * 3 + eqDp
    else:
        eqDp, lessDp = eqDp, lessDp * 3

     l == '1' l '1' eqDp, lessDp = eqDp * 2, lessDp * 3 + eqDp eqDp eqDp * 2 eqDp 2 lessDp lessDp * 3 + eqDp lessDp * 3 lessDp 3 eqDp eqDp, lessDp = eqDp, lessDp * 3 eqDp eqDp lessDp lessDp * 3 lessDp 3 eqDp %= MOD eqDp MOD lessDp %= MOD lessDp MOD print((eqDp + lessDp) % MOD) print (eqDp + lessDp) % MOD eqDp + lessDp eqDp lessDp MOD L = input() input() L lessDp = eqDp * 2, lessDp * 3 + eqDp lessDp * 3 + eqDp lessDp eqDp %= MOD MOD eqDp MOD = 10**9 + 7 10**9 + 7 MOD eqDp, lessDp = eqDp, lessDp * 3 eqDp eqDp eqDp, lessDp = eqDp * 2, lessDp * 3 + eqDp eqDp * 2 eqDp eqDp = 1 1 eqDp lessDp = 0 0 lessDp lessDp = eqDp, lessDp * 3 lessDp * 3 lessDp lessDp %= MOD MOD lessDp
L = input()
MOD = 10**9 + 7

eqDp = 1
lessDp = 0

for l in L:
    if l == '1':
        eqDp, lessDp = eqDp * 2, lessDp * 3 + eqDp
    else:
        eqDp, lessDp = eqDp, lessDp * 3

    eqDp %= MOD
    lessDp %= MOD

print((eqDp + lessDp) % MOD)
