s=input()
n=len(s)
mod=10**9+7
dp=[[0]*2 for _ in range(n)]
dp[0][0]=2
dp[0][1]=1
for i in range(n-1):
  d=int(s[i+1])
  dp[i+1][1]=(3*dp[i][1]+d*dp[i][0])%mod
  dp[i+1][0]=(dp[i][0]+d*dp[i][0])%mod
print(sum(dp[-1])%mod) s=input() s input() input n=len(s) n len(s) len s mod=10**9+7 mod 10**9+7 10**9 10 9 7 [0]*2 for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [0]*2 [0] 0 2 dp=[[0]*2 for _ in range(n)] dp [[0]*2 for _ in range(n)] dp[0][0]=2 dp[0][0] [0] dp 0 0 2 dp[0][1]=1 dp[0][1] [0] dp 0 1 1 for i in range(n-1):
  d=int(s[i+1])
  dp[i+1][1]=(3*dp[i][1]+d*dp[i][0])%mod
  dp[i+1][0]=(dp[i][0]+d*dp[i][0])%mod i range(n-1) range n-1 n 1 d=int(s[i+1]) d int(s[i+1]) int s[i+1] s i+1 i 1 dp[i+1][1]=(3*dp[i][1]+d*dp[i][0])%mod dp[i+1][1] [i+1] dp i+1 i 1 1 (3*dp[i][1]+d*dp[i][0])%mod 3*dp[i][1]+d*dp[i][0] 3*dp[i][1] 3 dp[i][1] [i] dp i 1 d*dp[i][0] d dp[i][0] [i] dp i 0 mod dp[i+1][0]=(dp[i][0]+d*dp[i][0])%mod dp[i+1][0] [i+1] dp i+1 i 1 0 (dp[i][0]+d*dp[i][0])%mod dp[i][0]+d*dp[i][0] dp[i][0] [i] dp i 0 d*dp[i][0] d dp[i][0] [i] dp i 0 mod print(sum(dp[-1])%mod) print sum(dp[-1])%mod sum(dp[-1]) sum dp[-1] dp -1 mod mod=10**9+7 10**9+7 mod d=int(s[i+1]) int(s[i+1]) d n=len(s) len(s) n dp=[[0]*2 for _ in range(n)] [[0]*2 for _ in range(n)] dp s=input() input() s
s=input()
n=len(s)
mod=10**9+7
dp=[[0]*2 for _ in range(n)]
dp[0][0]=2
dp[0][1]=1
for i in range(n-1):
  d=int(s[i+1])
  dp[i+1][1]=(3*dp[i][1]+d*dp[i][0])%mod
  dp[i+1][0]=(dp[i][0]+d*dp[i][0])%mod
print(sum(dp[-1])%mod)