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

def mpow(x, n)
  ret = 1
  while n > 0
    if n.even?
      x = x * x % M
      n >>= 1
    else
      ret = ret * x % M
      n -= 1
    end
  end
  ret
end

ans, c, l = 0, 0, L.length
L.split('').map.with_index{|c, i| c == '1' ? i : nil}.compact.each do |i|
  d = l - i - 1
  ans += mpow(3, d) * mpow(2, c)
  ans %= M
  c += 1
end
ans += mpow(2, c)
puts ans % M