const val mod = 1000000007
fun main(args: Array<String>) {
    val l = readLine()!!.map { it=='1' }

    var eq = 1L
    var ok = 0L

    l.forEach {
        if(it) {
            ok = (eq+ok*3)%mod
            eq = (eq*2)%mod
        } else {
            ok = (ok*3)%mod
        }
    }
    println( (eq+ok)%mod )
}