#include using namespace std; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define fore(i,a) for(auto &i:a) typedef long long ll; typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 2147483647; const ll INFL = 9223372036854775807; const ll mod = 1000000007; int main() { int l1, c1, r1; int l2, c2, r2; REP(i, 3) { char c; cin >> c; if (i == 0) { if (c == '?') { l1 = 1; l2 = 4; } else l1 = l2 = c - '0'; }else if (i == 1) { if (c == '?') { c1 = 1; c2 = 4; } else c1 = c2 = c - '0'; }else if (i == 2) { if (c == '?') { r1 = 1; r2 = 4; } else r1 = r2 = c - '0'; } } if (l1 > c1&&c1 < r1)cout << 1; else if(l1 < c1&&c1 > r1)cout << 1; if (l2 > c2&&c2 < r2)cout << 4; else if (l2 < c2&&c2 > r2)cout << 4; cout << endl; return 0; }