s = list(input().split()) pos = s.index('?') ans = "" one = s.copy() one[pos] = 1 one = list(map(int, one)) four = s.copy() four[pos] = 4 four = list(map(int, four)) if one[1] > one[0] and one[1] > one[2] or one[1] < one[0] and one[1] < one[2]: ans += '1' if four[1] > four[0] and four[1] > four[2] or four[1] < four[0] and four[1] < four[2]: ans += '4' print(ans)