import scala.io.StdIn._
object Main extends App {
  val MOD = 1000000007L
  val L = readLine.trim
  implicit val memo = Array.fill(L.length + 1){-1L}
  println(
    cal(L.toList.map(_ == '1'), L.length)
  )
  def cal(digits: List[Boolean], length: Int)(implicit memo: Array[Long]): Long = {
    if (memo(length) >= 0) return memo(length)
    memo(length) = digits match {
      case Nil ⇒ 1
      case true::rest ⇒ (cal(rest, length - 1) * 2 + power(3, length - 1)) % MOD
      case false::rest ⇒ cal(rest, length - 1)
    }
    memo(length)
  }
  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
    }
  }
}
