from typing import Sequence def is_kadomatsu(height_seq: Sequence[int]) -> bool: if len(set(height_seq)) != 3: return False if max(height_seq) == height_seq[1] or min(height_seq) == height_seq[1]: return True return False def main(): c = list(input().split()) question_idx = c.index("?") c_1 = c.copy() c_1[question_idx] = 1 c_2 = c.copy() c_2[question_idx] = 4 c_1 = list(map(int, c_1)) c_2 = list(map(int, c_2)) if is_kadomatsu(c_1): if is_kadomatsu(c_2): print(14) else: print(1) else: print(4) if __name__ == "__main__": main()