program main
  implicit none
  integer(8) :: n, i, m, dpless, dpsame
  character(100001) :: l
  m = 10 ** 9 + 7
  read *, l
  n = len_trim(l)
  dpsame = 1
  dpless = 0
  do i = 1, n
    dpless = dpless * 3
    dpless = modulo(dpless, m)
    if (l(i:i) == "1") then
      dpless = dpless + dpsame
      dpless = modulo(dpless, m)
      dpsame = dpsame * 2
      dpsame = modulo(dpsame, m)
    end if
  end do
  print "(i0)", modulo(dpless + dpsame, m)
end program main
