carray = input().split() carray_four = list(map(int,["4" if i=="?" else i for i in carray ])) carray_one = list(map(int,["1" if i=="?" else i for i in carray ])) condition_four = len(set(carray_four))==3 and ((max(carray_four)==carray_four[1]) or (min(carray_four)==carray_four[1])) condition_one = len(set(carray_one))==3 and ((max(carray_one)==carray_one[1]) or (min(carray_one)==carray_one[1])) if condition_four and condition_one: print("14") elif condition_four and not(condition_one): print("4") else: print("1")