def main(): C = input().split() i = C.index('?') if i == 0: if C[i+1]=='2': print(4) else: print(1) elif i == 1: print(14) else: if C[0] == '3': print(1) else: print(4) if __name__ == '__main__': main()