local mod = 1000000007
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local p2 = {2}
for i = 2, 100010 do
  p2[i] = badd(p2[i - 1], p2[i - 1])
end
local s = io.read()
local max, normal = 1, 0
for i = 1, #s do
  local v = s:byte(i) - 48
  if v == 1 then
    max, normal = badd(max, max), badd(max, bmul(normal, 3))
  else
    max, normal = max, bmul(normal, 3)
  end
end
print(badd(max, normal))
