import sys input = sys.stdin.readline C=input().split() x=C.index("?") ANS="" C[x]="1" if len(set(C))==3 and (max(C)==C[1] or min(C)==C[1]): ANS+="1" C[x]="4" if len(set(C))==3 and (max(C)==C[1] or min(C)==C[1]): ANS+="4" print(ANS)