import scala.annotation.tailrec
import scala.io.StdIn._
object Main extends App {
  val MOD = 1000000007L
  val L = readLine.trim
  println(
    cal(L.reverse.toList.map(_ == '1'))
  )
  @tailrec def cal(digits: List[Boolean], length: Int = 0, acc: Long = 1): Long = {
    digits match {
      case Nil ⇒ acc
      case true::rest ⇒ cal(rest, length + 1, (acc * 2 + power(3, length)) % MOD)
      case false::rest ⇒ cal(rest, length + 1, acc)
    }
  }
  def power(base: Long, exp: Int): Long = {
    exp match {
      case 0 ⇒ 1L
      case 1 ⇒ base % MOD
      case _ ⇒ power(base * base % MOD, exp >> 1) * power(base, exp & 1) % MOD
    }
  }
}
