c1, c2, c3 = input().split() if c2 == '?': print('14') exit() if c1 == '?': print('1' if c2 > c3 else '4') else: print('1' if c2 > c1 else '4')