import java.lang.Long.parseLong
import java.util.*

fun main(args:Array<String>) {
    var L = readLine()!!

    val mod = 1000000007L
    val dp = longArrayOf(1L, 0L)
    // 1 1 0 0
    // 1 0 1 0

    for (l in L) {
        if (l == '0') {
            dp[1] = dp[1]*3%mod
        } else {
            dp[1] = (dp[0]+dp[1]*3)%mod
            dp[0] = dp[0]*2%mod
        }
    }

    println(dp.sum()%mod)
}