#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
char s[300010];
ll mod=1e9+7;
ll mem[300010][2][2][2][2][2], n;
ll dp(int x, int l, int b, bool pre, bool l2, bool z){
//  cout<<x<<" "<<l<<" "<<b<<" "<<pre<<" "<<l2<<" "<<z<<endl;
  if(x==n)
    return (b&&l2)||(l&&pre)||(z)||(l2&&pre);
  if(mem[x][l][b][pre][l2][z]!=-1)
    return mem[x][l][b][pre][l2][z];
  if(s[x]!='?'){
    if(x==0)
      mem[x][l][b][pre][l2][z]=dp(x+1, 0, 0, s[x]-'0', s[x]-'0', 0);
    else
      mem[x][l][b][pre][l2][z]=dp(x+1, l||((s[x]=='1')&&pre&&(x%2==0)), b||(s[x]=='1'&&pre&&(x%2)), s[x]-'0', l2, z||(s[x]=='1'&&pre&&(x%2)&&l));
    mem[x][l][b][pre][l2][z]%=mod;
    return mem[x][l][b][pre][l2][z];
  }
  ll ans=0;
  if(x==0)
    ans=dp(x+1, 0, 0, 1, 1, 0)+dp(x+1, 0, 0, 0, 0, 0);
  else
    ans=dp(x+1, l||(pre&&(x%2==0)), b||(pre&&(x%2)), 1, l2, z||((pre&&(x%2))&&l))+dp(x+1, l, b, 0, l2, z);
  ans%=mod;
  mem[x][l][b][pre][l2][z]=ans;
  return ans;
}

int main(){
  scanf("%s",s);
  n=strlen(s);
  memset(mem, -1, sizeof mem);
  ll ans=dp(0,0,0,0,0,0);
  cout<<ans<<endl;
  return 0;
}

