a = input()
s = len(a)
MOD = 10**9 + 7
dp = [0]*100010
ep = [0]*100010

dp[0] = 1

for i in range(s):
    ep[i+1]+= 3*ep[i]
    if a[i] == '1':
        dp[i+1] += 2*dp[i]
        ep[i+1] += dp[i]
    else:
        dp[i+1]+=dp[i]
    
    ep[i+1]%=MOD
    dp[i+1]%=MOD
ans = (dp[s]+ep[s])%MOD
print(ans) a = input() a input() input s = len(a) s len(a) len a MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 dp = [0]*100010 dp [0]*100010 [0] 0 100010 ep = [0]*100010 ep [0]*100010 [0] 0 100010 dp[0] = 1 dp[0] dp 0 1 for i in range(s):
    ep[i+1]+= 3*ep[i]
    if a[i] == '1':
        dp[i+1] += 2*dp[i]
        ep[i+1] += dp[i]
    else:
        dp[i+1]+=dp[i]
    
    ep[i+1]%=MOD
    dp[i+1]%=MOD i range(s) range s ep[i+1]+= 3*ep[i] ep[i+1] ep i+1 i 1 3*ep[i] 3 ep[i] ep i if a[i] == '1':
        dp[i+1] += 2*dp[i]
        ep[i+1] += dp[i]
    else:
        dp[i+1]+=dp[i]
    
     a[i] == '1' a[i] a i '1' dp[i+1] += 2*dp[i] dp[i+1] dp i+1 i 1 2*dp[i] 2 dp[i] dp i ep[i+1] += dp[i] ep[i+1] ep i+1 i 1 dp[i] dp i dp[i+1]+=dp[i] dp[i+1] dp i+1 i 1 dp[i] dp i ep[i+1]%=MOD ep[i+1] ep i+1 i 1 MOD dp[i+1]%=MOD dp[i+1] dp i+1 i 1 MOD ans = (dp[s]+ep[s])%MOD ans (dp[s]+ep[s])%MOD dp[s]+ep[s] dp[s] dp s ep[s] ep s MOD print(ans) print ans dp = [0]*100010 [0]*100010 dp s = len(a) len(a) s ans = (dp[s]+ep[s])%MOD (dp[s]+ep[s])%MOD ans a = input() input() a MOD = 10**9 + 7 10**9 + 7 MOD ep = [0]*100010 [0]*100010 ep
a = input()
s = len(a)
MOD = 10**9 + 7
dp = [0]*100010
ep = [0]*100010

dp[0] = 1

for i in range(s):
    ep[i+1]+= 3*ep[i]
    if a[i] == '1':
        dp[i+1] += 2*dp[i]
        ep[i+1] += dp[i]
    else:
        dp[i+1]+=dp[i]
    
    ep[i+1]%=MOD
    dp[i+1]%=MOD
ans = (dp[s]+ep[s])%MOD
print(ans)