#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
template<unsigned int mod_>
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	constexpr static uint mod = mod_;

	uint v;
	ModInt():v(0){}
	ModInt(ll v):v(normS(v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll u[]={a,1,0},v[]={b,0,1};
		while(*v){
			ll t=*u/ *v;
			rep(i,3) swap(u[i]-=t*v[i],v[i]);
		}
		if(u[0]<0) rep(i,3) u[i]=-u[i];
		x=u[1],y=u[2];
		return u[0];
	}
	ModInt inv() const{
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<1000000007>;

map<string,bool> mp;

bool can(string s){
	if(mp.count(s)) return mp[s];
	if(s.size()==1) return s[0]=='1';
	int N = s.size();
	bool res = 0;
	rep1(i,N-2){
		int cnt = (s[i-1]=='1') + (s[i]=='1') + (s[i+1]=='1');
		string ns = s.substr(0,i-1) + (cnt>=2?'1':'0') + s.substr(i+2,N-2-i);
		if(can(ns)) res = 1;
	}
	return mp[s] = res;
}


mint solve(string s){
	int N = s.size();
	if(N==1){
		if(s[0]=='0') return 0;
		return 1;
	}
	mint dp[3][4]={};
	dp[0][0] = 1;

	rep(i,N){
		mint ndp[3][4] = {};
		if(s[i]!='1'){	//put 0
			rep(i,3) rep(j,4){
				int ni = i, nj = -1;
				if(j==0){
					nj = 1;
				}
				if(j==1){
					nj = 2;
				}
				if(j==2){
					nj = 1;
				}
				if(j==3){
					nj = 1;
				}
				ndp[ni][nj] += dp[i][j];
			}
		}
		if(s[i]!='0'){	//put 1
			rep(i,3) rep(j,4){
				int ni = i, nj = -1;
				if(j==0){
					ni++;
					nj = 0;
				}
				if(j==1){
					nj = 3;
				}
				if(j==2){
					nj = 1;
				}
				if(j==3){
					ni++;
					nj = 0;
				}
				if(ni==3) ni = 2;
				ndp[ni][nj] += dp[i][j];
			}
		}
		rep(i,3) rep(j,4) dp[i][j] = ndp[i][j];
	}
	mint ans = 0;
	rep(j,4) ans += dp[2][j];
	ans += dp[1][0]+dp[1][3];
//	cout<<ans<<endl;
	return ans;
	// if((ans==1) != can(s)){
	// 	show(s);
	// 	show(ans);
	// 	assert(0);
	// }
	// while(true){
	// 	string s;
	// 	cin>>s;
	// 	show(can(s));
	// }
	// int N,K;
	// cin>>N>>K;
	// rep(i,1<<N){
	// 	string s;
	// 	rep(j,N) s += '0'+((i>>j)&1);
	// 	if(__builtin_popcount(i)==K && can(s)) cout<<s<<endl;
	// }

}
int main(){
	// int N;
	// cin>>N;
	// srand((unsigned)time(NULL));
	// while(true){
	// 	string s;
	// 	rep(i,N) s+='0'+rand()%2;
	// 	solve(s);
	// }
	string s;
	cin>>s;
	cout<<solve(s)<<endl;
}

Measured memory_bytes: 1028