def pow(x, n, mod)
  ans = 1
  while n > 0
    ans = ans * x % mod if n.odd?
    x = x * x % mod
    n >>= 1
  end
  ans
end

L = gets.chomp
MOD = 10 ** 9 + 7

ans = 0
LS = L.size
count_one = 1
(0...L.size).each{|i|
  if L[i] == '1' then
    ans += ((pow(3, LS - i - 1, MOD) + 1) * count_one) % MOD
    count_one = (2 * count_one) % MOD
  end
}

puts (ans + 1) % MOD
