#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c v(3);re(i, 3) std::cin >> v[i]; ll num = -1; for(int i=0;i<3;i++) if(v[i]=='?') num = i; bool f, g; if(num==0){ f = check(1, v[1] - '0' , v[2] - '0'); g = check(4, v[1] - '0' , v[2] - '0'); }else if(num==1){ f = check(v[0]-'0', 1 , v[2] - '0'); g = check(v[0]-'0', 4 , v[2] - '0'); }else{ f = check(v[0]-'0', v[1]- '0', 1); g = check(v[0]-'0', v[1]-'0' , 4); } if(f&&g) std::cout << "14" << '\n'; else if(f) std::cout << "1" << '\n'; else if(g) std::cout << "4" << '\n'; }