c_str = input().replace(" ","") c_replace_1_list = list(map(int,c_str.replace("?","1"))) c_replace_4_list = list(map(int,c_str.replace("?","4"))) if c_replace_1_list[1] == min(c_replace_1_list) or c_replace_1_list[1] == max(c_replace_1_list): print(1,end = "") if c_replace_4_list[1] == min(c_replace_4_list) or c_replace_4_list[1] == max(c_replace_4_list): print(4)