#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


/*
int N;
Graph G;

int main() {
  cin >>N;
  rep(i, N-1){
    int a,b; cin >>a >>b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
}
*/

int main() {
  string s; cin >>s;
  int n = s.size();
  if (n == 2) cout <<s <<endl;
  else{
    reverse(all(s)); cout <<s <<endl;
  }
}
/*
* @Author: wxyww
* @Date: 2020-03-31 09:07:10
* @Last Modified time: 2020-03-31 09:20:33
*/
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int N = 300010,mod = 1e9 + 7;
ll read() {
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
char s[N];
int e[9][2],f[10][N];
void add(int &x,int y) {
	(x = x + y) >= mod ? x -= mod : 0;
}
int main() {
	e[1][0] = 2;e[1][1] = 5;
	e[2][0] = 3;e[2][1] = 4;
	e[3][0] = 2;e[3][1] = 2;
	e[4][0] = 2;e[4][1] = 5;
	e[5][0] = 7;e[5][1] = 6;
	e[6][0] = 6;e[6][1] = 6;
	e[7][0] = 8;e[7][1] = 5;
	e[8][0] = 7;e[8][1] = 7;
	scanf("%s",s + 1);
	int n = strlen(s + 1);

	f[1][0] = 1;

	for(int i = 0;i < n;++i) {
		for(int j = 1;j <= 8;++j) {
			if(s[i + 1] == '1' || s[i + 1] == '?') 
				add(f[e[j][1]][i + 1],f[j][i]);
			if(s[i + 1] == '0' || s[i + 1] == '?')
				add(f[e[j][0]][i + 1],f[j][i]);
		}
	}

	cout<<(f[6][n] + f[5][n]) % mod;



	return 0;
}