You are given an initial integer A = 1.
You will receive B queries, each representing an operation that can be applied to the current value of A. The operations appear in a fixed order, but you are not required to execute every operation. You may choose any subset of the queries, but if you choose an operation, it must be applied in the same order as given.
Your goal is to maximize the final value of A after processing the queries.
The possible operations are:
plus x → Add x to the current value of A
minus x → Subtract x from the current value of A
multiply x → Multiply the current value of A by x
/ x → Divide the current value of A by x
This operation can only be performed if A is divisible by x
N → Negate the current value of A (i.e., A = -A)
You may skip any operation, but the relative order of executed operations must remain the same as in the input.
Return the maximum possible value of A after processing the queries.