c = input().split() if c[0] == '?' or c[2] == '?' and c[1] == '2': print('4') elif c[0] == '?' or c[2] == '?' and c[1] == '3': print('1') else: print('14')