// Author: Shusuke Ueda
// AtCoder Beginner Contest 129 - Problem E

#include <iostream>

namespace nt {
    template <typename T, typename U>
    T pow(T n, U p) {
        T res = 1;
        while (p > 0) {
            if (p % 2 == 1) {
                res *= n;
            }
            n *= n;
            p /= 2;
        }
        return res;
    }

    template <int_fast64_t mod>
    class ModInt {
        int_fast64_t val;

      public:
        ModInt(): val(0) {}
        ModInt(int_fast64_t init_val): val(init_val >= 0? init_val % mod: mod - (-init_val % mod)) {}

        friend std::istream& operator >> (std::istream& is, ModInt& n) {
            int_fast64_t init_val;
            is >> init_val;
            n = ModInt(init_val);
            return is;
        }
        friend std::ostream& operator << (std::ostream& os, const ModInt n) {
            os << n.val;
            return os;
        }

        ModInt operator -() const {
            return ModInt(-val);
        }
        bool operator !() const {
            return val == 0;
        }
        ModInt& operator ++() {
            val++;
            if (val >= mod) {
                val -= mod;
            }
            return *this;
        }
        ModInt operator ++(int) {
            ModInt tmp = *this;
            val++;
            if (val >= mod) {
                val -= mod;
            }
            return tmp;
        }
        ModInt& operator --() {
            val--;
            if (val < 0) {
                val += mod;
            }
            return *this;
        }
        ModInt operator --(int) {
            ModInt tmp = *this;
            val--;
            if (val < 0) {
                val += mod;
            }
            return tmp;
        }

        ModInt& operator += (const ModInt that) {
            val += that.val;
            if (val >= mod) {
                val -= mod;
            }
            return *this;
        }
        ModInt& operator -= (const ModInt that) {
            val -= that.val;
            if (val < 0) {
                val += mod;
            }
            return *this;
        }
        ModInt& operator *= (const ModInt that) {
            val = val * that.val % mod;
            return *this;
        }
        ModInt& operator /= (const ModInt that) {
            int_fast64_t res = 1, n = that.val, p = mod - 2;
            while (p > 0) {
                if (p % 2 == 1) {
                    res = res * n % mod;
                }
                n = n * n % mod;
                p /= 2;
            }
            val = val * res % mod;
            return *this;
        }

        ModInt operator + (const ModInt that) const {
            return ModInt(*this) += that;
        }
        ModInt operator - (const ModInt that) const {
            return ModInt(*this) -= that;
        }
        ModInt operator * (const ModInt that) const {
            return ModInt(*this) *= that;
        }
        ModInt operator / (const ModInt that) const {
            return ModInt(*this) /= that;
        }
    };

    using mint = ModInt<1000000007>;
}

int main() {
    std::string s;
    std::cin >> s;

    nt::mint ans = 0;
    int n = s.length(), left_one = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '1') {
            ans += nt::pow(nt::mint(2), left_one) * nt::pow(nt::mint(3), n - i - 1);
            left_one++;
        }
    }
    ans += nt::pow(nt::mint(2), left_one);

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 512