Coins

Maintain the probability that the number of heads among N coins is odd, under M point updates to individual coin probabilities, and report which outcome is more likely after each update.

Medium7MathProbabilityDynamic programmingImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

There are NN coins with possibly different heads probabilities. Toss all NN coins. You survive when the number of heads is odd, and you die when it is even.

An initial state is given, followed by MM updates. Each update specifies a coin index and its new heads probability. Compare the survival probability against the death probability in each of the M+1M+1 states, from the initial state with 00 updates to the final state with MM updates.

Input

The first line contains NN and MM, where 1N5000001 \le N \le 500000 and 0M5000000 \le M \le 500000. The second line contains NN real numbers. The ii-th number is the heads probability of coin ii. Each of the following MM lines contains a coin index and its new probability.

Every probability is at least 00 and at most 11, written with up to 66 digits after the decimal point.

Output

Print M+1M+1 lines. Line ii holds the answer for the state after i1i-1 updates.

Print "ALIVE" when survival is more likely and "DEAD" when death is more likely. Print "SAME" when the two probabilities are equal.

Hint

With heads probabilities 0.30.3, 0.40.4, and 0.70.7, survival has probability 0.5160.516 and death has probability 0.4840.484. Survival is more likely.