Find the product
You are given an array of N integers and Q queries. Queries consist of two integers i and X which means that you should replace the ith integer in the array with the value X. After each query you should output the product of all the numbers in the array modulo 10 ^ 9 + 7.
InputIn the first line there are two integers N and Q, 1 \leq N, Q \leq 10 ^ 5. In the second line there are N integers which represents the elements of the array A, 1 \leq Ai \leq 10^{9}, and in the next Q lines there are two integers X and Y, 1 \leq X \leq N, 1 \leq Y \leq 10^{9} which represents the queries.
OutputOutput Q lines which represent the answers to the queries.
Input
Output
3 3
1 2 3
1 4
2 5
3 6Output
24
60
120Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.