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

DP1 = [0]
DP2 = [1]

for i in L:
    if i == '1':
        x = (DP1[-1]*3+DP2[-1])%MOD
        y = (DP2[-1]*2)%MOD
        DP1.append(x)
        DP2.append(y)
    else:
        x = (DP1[-1]*3)%MOD
        DP1.append(x)
print((DP1[-1]+DP2[-1])%MOD) MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 L = input() L input() input DP1 = [0] DP1 [0] 0 DP2 = [1] DP2 [1] 1 for i in L:
    if i == '1':
        x = (DP1[-1]*3+DP2[-1])%MOD
        y = (DP2[-1]*2)%MOD
        DP1.append(x)
        DP2.append(y)
    else:
        x = (DP1[-1]*3)%MOD
        DP1.append(x) i L if i == '1':
        x = (DP1[-1]*3+DP2[-1])%MOD
        y = (DP2[-1]*2)%MOD
        DP1.append(x)
        DP2.append(y)
    else:
        x = (DP1[-1]*3)%MOD
        DP1.append(x) i == '1' i '1' x = (DP1[-1]*3+DP2[-1])%MOD x (DP1[-1]*3+DP2[-1])%MOD DP1[-1]*3+DP2[-1] DP1[-1]*3 DP1[-1] DP1 -1 3 DP2[-1] DP2 -1 MOD y = (DP2[-1]*2)%MOD y (DP2[-1]*2)%MOD DP2[-1]*2 DP2[-1] DP2 -1 2 MOD DP1.append(x) DP1.append DP1 append x DP2.append(y) DP2.append DP2 append y x = (DP1[-1]*3)%MOD x (DP1[-1]*3)%MOD DP1[-1]*3 DP1[-1] DP1 -1 3 MOD DP1.append(x) DP1.append DP1 append x print((DP1[-1]+DP2[-1])%MOD) print (DP1[-1]+DP2[-1])%MOD DP1[-1]+DP2[-1] DP1[-1] DP1 -1 DP2[-1] DP2 -1 MOD DP1 = [0] [0] DP1 L = input() input() L x = (DP1[-1]*3+DP2[-1])%MOD (DP1[-1]*3+DP2[-1])%MOD x MOD = 10**9+7 10**9+7 MOD x = (DP1[-1]*3)%MOD (DP1[-1]*3)%MOD x DP2 = [1] [1] DP2 y = (DP2[-1]*2)%MOD (DP2[-1]*2)%MOD y
MOD = 10**9+7
L = input()

DP1 = [0]
DP2 = [1]

for i in L:
    if i == '1':
        x = (DP1[-1]*3+DP2[-1])%MOD
        y = (DP2[-1]*2)%MOD
        DP1.append(x)
        DP2.append(y)
    else:
        x = (DP1[-1]*3)%MOD
        DP1.append(x)
print((DP1[-1]+DP2[-1])%MOD)
