// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/01/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

template <typename T, T MOD>
class modint {
 private:
  T val_;

 public:
  constexpr modint() : val_(0) {}
  constexpr modint(T v) : val_(v%MOD) {}
  constexpr modint& operator=(T v) { val_ = v%MOD; return *this; }

  constexpr T val() const { return val_; }
  constexpr modint operator+(modint x) const { return (val() + x.val())%MOD; }
  constexpr modint operator+=(modint x) { return *this = *this + x; }
  constexpr modint operator++() { return *this += 1; }
  constexpr modint operator++(int) { modint c = *this; ++(*this); return c; }
  constexpr modint operator-(modint x) const { return (val() + MOD - x.val())%MOD; }
  constexpr modint operator-=(modint x) { return *this = *this - x; }
  constexpr modint operator--() { return *this -= 1; }
  constexpr modint operator--(int) { modint c = *this; --(*this); return c; }
  constexpr modint operator*(modint x) const { return (val() * x.val())%MOD; }
  constexpr modint operator*=(modint x) { return *this = *this * x; }
  friend constexpr modint pow(modint x, T p) {
    modint t = 1;
    modint u = x;
    while (p) {
      if (p & 1)
        t *= u;
      u *= u;
      p >>= 1;
    }
    return t;
  }
  constexpr modint operator/(modint x) const { return *this * pow(modint{x}, MOD-2); }
  constexpr modint operator/=(modint x) { return *this = *this / x; }

  constexpr bool operator==(modint x) const { return val() == x.val(); }
  constexpr bool operator!=(modint x) const { return val() != x.val(); }
  constexpr bool operator<(modint x) const { return val() < x.val(); };
  constexpr bool operator<=(modint x) const { return val() <= x.val(); };
  constexpr bool operator>(modint x) const { return val() > x.val(); };
  constexpr bool operator>=(modint x) const { return val() >= x.val(); };

  friend std::ostream& operator<<(std::ostream& os, modint x) {
    return os << x.val();
  }
  friend std::istream& operator>>(std::istream& is, modint& x) {
    return is >> x.val_;
  }

};

template <typename T, T MOD, T MAX>
class combination {
 public:
  using mint = modint<T, MOD>;
 private:
  vector<mint> fact_;
  vector<mint> ifact_;

 public:
  constexpr combination() {
    fact_.resize(MAX+1);
    fact_[0] = 1;
    for (size_t i = 1; i <= MAX; ++i) {
      fact_[i] = fact_[i-1] * i;
    }
    ifact_.resize(MAX+1);
    ifact_[MAX] = mint(1)/fact_[MAX];
    for (int i = MAX-1; i >= 0; i--) {
      ifact_[i] = ifact_[i+1] * (i+1);
    }
  }

  mint operator()(T p, T q) const {
    return fact_[p] * ifact_[q] * ifact_[p-q];
  }

};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);

  using combination = combination<unsigned long long, (unsigned long long)(1e9+7), (unsigned long long)(100010)>;
  using mint = combination::mint;

  string L; cin>>L;
  const size_t l = L.size();
  mint ans = 0;
  size_t rank = 0;
  for (int i = 0; i < l; i++) {
    if (L[i] == '1') {
      ans += pow(mint{2}, rank) * pow(mint{3}, l-i-1);
      ++rank;
    }
  }
  ans += pow(mint{2}, rank);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512