L = input()
N = len(L)

MOD = 10 ** 9 + 7

if L[0] == "1":
  e = [2]
  l = [1]
else:
  e = [1]
  l = [0]
  
for i in range(1, N):
  if L[i] == "1":
    de = (e[-1] * 2) % MOD
    dl = (e[-1] * 1 + l[-1] * 3) % MOD
  else:
    de = (e[-1] * 1) % MOD
    dl = (e[-1] * 0 + l[-1] * 3) % MOD
  e.append(de)
  l.append(dl)
#print("e:", e)
#print("l:", l)
print((e[-1] + l[-1]) % 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 if L[0] == "1":
  e = [2]
  l = [1]
else:
  e = [1]
  l = [0]
   L[0] == "1" L[0] L 0 "1" e = [2] e [2] 2 l = [1] l [1] 1 e = [1] e [1] 1 l = [0] l [0] 0 for i in range(1, N):
  if L[i] == "1":
    de = (e[-1] * 2) % MOD
    dl = (e[-1] * 1 + l[-1] * 3) % MOD
  else:
    de = (e[-1] * 1) % MOD
    dl = (e[-1] * 0 + l[-1] * 3) % MOD
  e.append(de)
  l.append(dl)
#print("e:", e)
#print("l:", l) i range(1, N) range 1 N if L[i] == "1":
    de = (e[-1] * 2) % MOD
    dl = (e[-1] * 1 + l[-1] * 3) % MOD
  else:
    de = (e[-1] * 1) % MOD
    dl = (e[-1] * 0 + l[-1] * 3) % MOD
   L[i] == "1" L[i] L i "1" de = (e[-1] * 2) % MOD de (e[-1] * 2) % MOD e[-1] * 2 e[-1] e -1 2 MOD dl = (e[-1] * 1 + l[-1] * 3) % MOD dl (e[-1] * 1 + l[-1] * 3) % MOD e[-1] * 1 + l[-1] * 3 e[-1] * 1 e[-1] e -1 1 l[-1] * 3 l[-1] l -1 3 MOD de = (e[-1] * 1) % MOD de (e[-1] * 1) % MOD e[-1] * 1 e[-1] e -1 1 MOD dl = (e[-1] * 0 + l[-1] * 3) % MOD dl (e[-1] * 0 + l[-1] * 3) % MOD e[-1] * 0 + l[-1] * 3 e[-1] * 0 e[-1] e -1 0 l[-1] * 3 l[-1] l -1 3 MOD e.append(de) e.append e append de l.append(dl) l.append l append dl print((e[-1] + l[-1]) % MOD) print (e[-1] + l[-1]) % MOD e[-1] + l[-1] e[-1] e -1 l[-1] l -1 MOD e = [1] [1] e l = [0] [0] l MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD de = (e[-1] * 1) % MOD (e[-1] * 1) % MOD de e = [2] [2] e l = [1] [1] l L = input() input() L de = (e[-1] * 2) % MOD (e[-1] * 2) % MOD de dl = (e[-1] * 1 + l[-1] * 3) % MOD (e[-1] * 1 + l[-1] * 3) % MOD dl dl = (e[-1] * 0 + l[-1] * 3) % MOD (e[-1] * 0 + l[-1] * 3) % MOD dl N = len(L) len(L) N
L = input()
N = len(L)

MOD = 10 ** 9 + 7

if L[0] == "1":
  e = [2]
  l = [1]
else:
  e = [1]
  l = [0]
  
for i in range(1, N):
  if L[i] == "1":
    de = (e[-1] * 2) % MOD
    dl = (e[-1] * 1 + l[-1] * 3) % MOD
  else:
    de = (e[-1] * 1) % MOD
    dl = (e[-1] * 0 + l[-1] * 3) % MOD
  e.append(de)
  l.append(dl)
#print("e:", e)
#print("l:", l)
print((e[-1] + l[-1]) % MOD)