a, b, c = map(str, input().split()) a_list = [a,b,c] index = a_list.index("?") del a_list[index] new_list = [int(i) for i in a_list] max_number = max(new_list) min_number = min(new_list) if max_number - min_number == 2: print(int((max_number+min_number)/2)) else: A = str(max_number+1)+str(min_number-1) print(A)