MOD = 10**9+7
T = [1]*(10**5+1)
D = [1]*(10**5+1)
for i in range(10**5):
  T[i+1] = T[i]*3 % MOD
  D[i+1] = D[i]*2 % MOD
L = input()
n = len(L)
ans = 1
count = 0
for i in range(n):
  if L[i] == "1":
    ans += (T[n-1-i]+1)*D[count]
    ans %= MOD
    count += 1
print(ans) MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 T = [1]*(10**5+1) T [1]*(10**5+1) [1] 1 10**5+1 10**5 10 5 1 D = [1]*(10**5+1) D [1]*(10**5+1) [1] 1 10**5+1 10**5 10 5 1 for i in range(10**5):
  T[i+1] = T[i]*3 % MOD
  D[i+1] = D[i]*2 % MOD i range(10**5) range 10**5 10 5 T[i+1] = T[i]*3 % MOD T[i+1] T i+1 i 1 T[i]*3 % MOD T[i]*3 T[i] T i 3 MOD D[i+1] = D[i]*2 % MOD D[i+1] D i+1 i 1 D[i]*2 % MOD D[i]*2 D[i] D i 2 MOD L = input() L input() input n = len(L) n len(L) len L ans = 1 ans 1 count = 0 count 0 for i in range(n):
  if L[i] == "1":
    ans += (T[n-1-i]+1)*D[count]
    ans %= MOD
    count += 1 i range(n) range n if L[i] == "1":
    ans += (T[n-1-i]+1)*D[count]
    ans %= MOD
    count += 1 L[i] == "1" L[i] L i "1" ans += (T[n-1-i]+1)*D[count] ans (T[n-1-i]+1)*D[count] T[n-1-i]+1 T[n-1-i] T n-1-i n-1 n 1 i 1 D[count] D count ans %= MOD ans MOD count += 1 count 1 print(ans) print ans T = [1]*(10**5+1) [1]*(10**5+1) T D = [1]*(10**5+1) [1]*(10**5+1) D ans %= MOD MOD ans MOD = 10**9+7 10**9+7 MOD L = input() input() L ans = 1 1 ans count += 1 1 count n = len(L) len(L) n count = 0 0 count ans += (T[n-1-i]+1)*D[count] (T[n-1-i]+1)*D[count] ans
MOD = 10**9+7
T = [1]*(10**5+1)
D = [1]*(10**5+1)
for i in range(10**5):
  T[i+1] = T[i]*3 % MOD
  D[i+1] = D[i]*2 % MOD
L = input()
n = len(L)
ans = 1
count = 0
for i in range(n):
  if L[i] == "1":
    ans += (T[n-1-i]+1)*D[count]
    ans %= MOD
    count += 1
print(ans)