// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);

int __inf_ignore(){
	int t = inf<int>;
	return t;
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

const int MOD = 1000000007;
//{{{ modular algebra
template<int mod=MOD>
struct Num{
	int v;
	template<class T>
	Num(T n){
		v = n%mod;
		if(v<0)v+=mod;
	}
	Num():v(0){}
	operator int() const {return v;}
	operator long long() const {return v;}
	inline void operator *=(const Num<mod> &a) {
		v = (v*(long long)a.v)%mod;
	}
	inline Num operator *(const Num<mod> &a) {
		Num n(*this);n*=a;
		return n;
	}
	inline void operator+=(const Num<mod> &a){
		v+=a.v;
		if(v>=mod)v-=mod;
		//	assert(0<=v and v<mod);
	}
	inline Num operator+(const Num<mod> &a){
		Num n(*this);n+=a;
		return n;
	}
	inline Num operator -(){
		if(v==0)return 0;
		else return Num(mod-v);
	}
	inline void operator -=(const Num<mod> &a){
		v-=a.v;
		if(v<0)v+=mod;
	}
	inline Num operator -(const Num<mod> &a){
		Num n(*this);n-=a;
		return n;
	}
#ifdef __GCD_H
	inline Num inv(){
		return Num(invMod(this->v,mod));
	}
	inline void operator /=(const Num<mod> &a){
		(*this)*=invMod(a.v,mod);
	}
	inline Num operator /(const Num<mod> &a){
		Num n(*this);n/=a;
		return n;
	}
#endif
};

template<class T, int mod>
T& operator <<(T &os, const Num<mod> &n){
	os<<(int)n.v;
	return os;
}

template<class T, int mod>
T& operator >>(T &is, Num<mod> &n){
	is>>n.v;
	return is;
}
//}}}
using Mint =  Num<MOD>;

//{{{ Mpow(Num<mod> x,Int k)
/* (x^k)%m */
template<int mod=MOD>
inline Num<mod> Mpow(Num<mod> x, Int k){
	if(k==0) return 1;
	Num<mod> res(Mpow(x,k/2));
	res*=res;
	if(k%2)res*=x;
	return res;
}
template<int mod=MOD>
inline Num<mod> __Mpow(const Num<mod> &x, Int k){
	if(k==0) return 1;
	Num<mod> res(__Mpow(x,k/2));
	res*=res;
	if(k%2)res*=x;
	return res;
}
template<class T, int mod=MOD>
inline Num<mod> Mpow(T x, Int k){
	return Mpow(Num<mod>(x),k);
}
//}}}

string L;

void solve(){
	cin>>L;
	Mint ans = 0, t = 1;
	for(int i = 0;i < L.size();i++){
		if(L[i]=='1'){
			ans += t * Mpow(3,L.size() - i - 1);
		}
		if(L[i]=='1')t *= 2;
	}
	ans += t;
	cout<<ans<<endl;

}
//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> L;
	solve();
	return 0;
}
//}}}


Measured memory_bytes: 512