Given $$$n$$$ gears, numbered from $$$1$$$ to $$$n$$$ such that for each $$$i$$$ $$$( 1 \leq i \leq n-1)$$$ the $$$i-th$$$ gear is directly connected to the $$$(i+1)-th$$$ gear. Each gear has a radius $$$r_i$$$ and is initially rotated by $$$m$$$ degrees in clockwise direction.
It is given that for every $$$i, j (1 \leq i, j \leq n)$$$ , $$$r_i$$$ divides $$$r_j$$$ or $$$r_j$$$ divides $$$r_i$$$.
There are $$$q$$$ queries, for each query $$$j$$$, Ahmed rotates the gear of index $$$a_j$$$ by $$$b_j$$$ degrees in clockwise direction. Given three integers $$$n$$$, $$$m$$$ and $$$q$$$, and the three arrays $$$r$$$, $$$a$$$ and $$$b$$$. Print after each query the number of gears that have degree $$$0$$$.
The first line of the input contains three integers $$$n, q and m (1 \leq n, q \leq 10^5; 0 \leq m \leq 359)$$$.
The second line of the input contains $$$n$$$ space separated integers, $$$r_1, r_2,..., r_n$$$ $$$( 1 \leq r_i \leq 10^9)$$$.
Each of the next q lines contains 2 integers $$$X$$$ and $$$Y$$$ $$$(1 \leq X \leq n; 0 \leq Y \leq 10^9)$$$, the index of the rotated gear and the number of degrees it was rotated respectively.
For each query, print the number of gears that have degree $$$0$$$.
($$$15$$$ Points) $$$1\leq n,q\leq 1000$$$,
($$$35$$$ Points) $$$m=0$$$.
($$$50$$$ Points) No additional constraints.
4 3 20 2 2 1 8 3 340 2 360 1 10
1 1 0
If gear $$$A$$$ is connected directly to gear $$$B$$$, rotating gear $$$A$$$ with $$$Y$$$ degrees will rotate gear $$$B$$$ by $$$-Y * r_A / r_B$$$ degrees.
If gear $$$A$$$ is connected directly to gear $$$B$$$, then gear $$$B$$$ is connected directly to gear $$$A$$$.
In the example:
After the first query, the angles become respectively: 190 -150 0 -22.5.
after the second query, the angles become respectively: 190 210 0 67.5.
after the third query, the angles become respectively: 200 200 20 -25.