l=gets.chomp
pow3=[1]
(1..l.size).each{|i|
  pow3[i] = pow3[i-1]*3
  }

sum=0;
n=0;
(0..l.size).each{|idx|
    if(l[idx]=="1")
        sum += (2**n)*pow3[l.size-idx-1]
        n+=1
    end
}
sum+=2**n
 
 
p sum % (10**9+7)