#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; bool check(const string& S){ if(S[0] == S[1] || S[1] == S[2] || S[0] == S[2]) return false; if(S[0] > S[1] && S[1] < S[2]) return true; if(S[0] < S[1] && S[1] > S[2]) return true; return false; } int main(){ string S(3,'?'); rep(i,3) cin >> S[i]; bool one = false, four = false; rep(i,3){ if(S[i] == '?'){ string T = S; T[i] = '1'; if(check(T)) one = true; T[i] = '4'; if(check(T)) four = true; } } if(one) cout << 1; if(four) cout << 4; cout << endl; return 0; }