c1, c2, c3 = map(str, input().split()) if c1 == '?' or c3 == '?': if c2 == '2': print('4') else: print('1') else: print('14')