L = input().split() print('14' if L[1] == '?' else ['1', '4'][L[1] == '2'])