def larger(x, y): if x > y: return x else: return y def smaller(x, y): if x < y: return x else: return y A = raw_input().split() hatena = 0 for i in range(0, 3): if A[i] == '?': hatena = i kadomatsu1 = [A[0], A[1], A[2]] kadomatsu4 = [A[0], A[1], A[2]] kadomatsu1[hatena] = '1' kadomatsu4[hatena] = '4' ans = '' if larger(larger(kadomatsu1[0], kadomatsu1[2]), kadomatsu1[1]) == kadomatsu1[1] or smaller(smaller(kadomatsu1[0], kadomatsu1[2]), kadomatsu1[1]) == kadomatsu1[1]: ans = ans + '1' if larger(larger(kadomatsu4[0], kadomatsu4[2]), kadomatsu4[1]) == kadomatsu4[1] or smaller(smaller(kadomatsu4[0], kadomatsu4[2]), kadomatsu4[1]) == kadomatsu4[1]: ans = ans + '4' print ans