ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
mod=10**9+7
L = input()
n = len(L)
dp1 = [0]*n#i桁目までがLより小さい
dp2=[0]*n#i桁目までがLと一致
dp1[0]=1 #00
dp2[0]=2 #01 or 10
for i in range(1,n):
    if L[i]=="1":
        dp1[i] = (2+1)*dp1[i-1]+1*dp2[i-1]
        dp2[i]= 2*dp2[i-1]
    elif L[i]=="0":
        dp1[i]=(2+1)*dp1[i-1]
        dp2[i]=dp2[i-1]
    dp1[i]%=mod
    dp2[i]%=mod
print((dp1[n-1]+dp2[n-1])%mod) ma = lambda :map(int,input().split()) ma lambda :map(int,input().split()) map(int,input().split()) map int input().split() ().split () input split lma = lambda :list(map(int,input().split())) lma lambda :list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split tma = lambda :tuple(map(int,input().split())) tma lambda :tuple(map(int,input().split())) tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split ni = lambda:int(input()) ni lambda:int(input()) int(input()) int input() input yn = lambda fl:print("Yes") if fl else print("No") yn lambda fl:print("Yes") if fl else print("No") print("Yes") if fl else print("No") fl print("Yes") print "Yes" print("No") print "No" fl import collections collections import math math import itertools itertools import heapq as hq heapq mod=10**9+7 mod 10**9+7 10**9 10 9 7 L = input() L input() input n = len(L) n len(L) len L dp1 = [0]*n dp1 [0]*n [0] 0 n dp2=[0]*n dp2 [0]*n [0] 0 n dp1[0]=1 dp1[0] dp1 0 1 dp2[0]=2 dp2[0] dp2 0 2 for i in range(1,n):
    if L[i]=="1":
        dp1[i] = (2+1)*dp1[i-1]+1*dp2[i-1]
        dp2[i]= 2*dp2[i-1]
    elif L[i]=="0":
        dp1[i]=(2+1)*dp1[i-1]
        dp2[i]=dp2[i-1]
    dp1[i]%=mod
    dp2[i]%=mod i range(1,n) range 1 n if L[i]=="1":
        dp1[i] = (2+1)*dp1[i-1]+1*dp2[i-1]
        dp2[i]= 2*dp2[i-1]
    elif L[i]=="0":
        dp1[i]=(2+1)*dp1[i-1]
        dp2[i]=dp2[i-1]
     L[i]=="1" L[i] L i "1" dp1[i] = (2+1)*dp1[i-1]+1*dp2[i-1] dp1[i] dp1 i (2+1)*dp1[i-1]+1*dp2[i-1] (2+1)*dp1[i-1] 2+1 2 1 dp1[i-1] dp1 i-1 i 1 1*dp2[i-1] 1 dp2[i-1] dp2 i-1 i 1 dp2[i]= 2*dp2[i-1] dp2[i] dp2 i 2*dp2[i-1] 2 dp2[i-1] dp2 i-1 i 1 elif L[i]=="0":
        dp1[i]=(2+1)*dp1[i-1]
        dp2[i]=dp2[i-1]
     L[i]=="0" L[i] L i "0" dp1[i]=(2+1)*dp1[i-1] dp1[i] dp1 i (2+1)*dp1[i-1] 2+1 2 1 dp1[i-1] dp1 i-1 i 1 dp2[i]=dp2[i-1] dp2[i] dp2 i dp2[i-1] dp2 i-1 i 1 dp1[i]%=mod dp1[i] dp1 i mod dp2[i]%=mod dp2[i] dp2 i mod print((dp1[n-1]+dp2[n-1])%mod) print (dp1[n-1]+dp2[n-1])%mod dp1[n-1]+dp2[n-1] dp1[n-1] dp1 n-1 n 1 dp2[n-1] dp2 n-1 n 1 mod mod=10**9+7 10**9+7 mod yn = lambda fl:print("Yes") if fl else print("No") lambda fl:print("Yes") if fl else print("No") yn dp2=[0]*n [0]*n dp2 ni = lambda:int(input()) lambda:int(input()) ni dp1 = [0]*n [0]*n dp1 ma = lambda :map(int,input().split()) lambda :map(int,input().split()) ma tma = lambda :tuple(map(int,input().split())) lambda :tuple(map(int,input().split())) tma L = input() input() L lma = lambda :list(map(int,input().split())) lambda :list(map(int,input().split())) lma n = len(L) len(L) n
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
mod=10**9+7
L = input()
n = len(L)
dp1 = [0]*n#i桁目までがLより小さい
dp2=[0]*n#i桁目までがLと一致
dp1[0]=1 #00
dp2[0]=2 #01 or 10
for i in range(1,n):
    if L[i]=="1":
        dp1[i] = (2+1)*dp1[i-1]+1*dp2[i-1]
        dp2[i]= 2*dp2[i-1]
    elif L[i]=="0":
        dp1[i]=(2+1)*dp1[i-1]
        dp2[i]=dp2[i-1]
    dp1[i]%=mod
    dp2[i]%=mod
print((dp1[n-1]+dp2[n-1])%mod)
