fun main(args: Array<String>) {
    val L = readInputLine().reversed().toCharArray()

    val mod = 1000000007L

    // dp[0:L未満 1:Lと一致 2:Lより大きい][n桁目での総数]
    val dp = Array(3) { LongArray(L.size) }

    when (L[0]) {
        '0' -> {
            // (0, 0)
            dp[1][0] = 1L
            // (1, 0), (0, 1)
            dp[2][0] = 2L
        }
        else -> {
            // (0, 0)
            dp[0][0] = 1L
            // (1, 0), (0, 1)
            dp[1][0] = 2L
        }
    }

    for (i in 1 until L.size) {
        when (L[i]) {
            '0' -> {
                // (0, 0)
                for (j in 0..2) {
                    dp[j][i] = dp[j][i - 1]
                }
                // (1, 0), (0, 1)
                for (j in 0..2) {
                    dp[2][i] += dp[j][i - 1] * 2L
                }
                dp[2][i] %= mod
            }
            else -> {
                // (0, 0)
                for (j in 0..2) {
                    dp[0][i] += dp[j][i - 1]
                }
                dp[0][i] %= mod
                // (1, 0), (0, 1)
                for (j in 0..2) {
                    dp[j][i] += dp[j][i - 1] * 2L
                    dp[j][i] %= mod
                }
            }
        }
    }

    println((dp[0][L.size - 1] + dp[1][L.size - 1]) % mod)
}

fun readInputLine(): String {
    return readLine()!!
}
