fun main(args: Array<String>) {
    val MOD = 1000000007L
    var S = Array<Long>(100002) { 0 }
    val L = "0" + readLine()!!
    val N = L.length
    var ret = 0L; var v = 1L; var a = 1L
    S[0] = 1
  	for (i in 0 until N) {
        S[i + 1] = S[i]
        if (L[i] == '1') S[i + 1] = S[i + 1] * 2 % MOD
    }
    for (i in N - 1 downTo 1) {
        if (L[i] == '1') {
            v = v * 2 % MOD
            ret += a * S[i] % MOD
        }
        a = a * 3 % MOD
    }
    ret += v; ret = ret % MOD
    println(ret)
}
