{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e现在有一个长度为 $$$n$$$ 的数组 $$$a$$$,我们对进行 $q$ 次操作:每次给两个整数 $$$i$$$ 和 $$$x$$$,将 $a_i$ 乘上 $x$。每次操作后,你都输出数组中所有元素的最大公约数(GCD)。\u003c/p\u003e\n\u003cp\u003e请将答案取模 $$$10^9+7$$$ 后输出。\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e第一行有两个整数 — $$$n$$$ 和 $$$q$$$ ($$$1 \\le n, q \\le 2 \\cdot 10^5$$$).\u003c/p\u003e\n\u003cp\u003e第二行有 $$$n$$$ 个整数 $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le 2 \\cdot 10^5$$$) 表示数组所有元素的初始值。\u003c/p\u003e\n\u003cp\u003e接下来 $$$q$$$ 行操作,每行给出两个整数 $$$i$$$ 和 $$$x$$$ ($$$1 \\le i \\le n$$$, $$$1 \\le x \\le 2 \\cdot 10^5$$$)。\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e输出 $$$q$$$ 行,代表每次操作后所有元素的 GCD。注意取模 $$$10^9+7$$$ 后再输出。\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 3\n1 6 8 12\n1 12\n2 3\n3 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n2\n6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e第一次操作后数组为 $$$[12, 6, 8, 12]$$$, $$$\\operatorname{gcd}(12, 6, 8, 12) \u003d 2$$$.\u003c/p\u003e\n\u003cp\u003e第二次操作后数组为 $$$[12, 18, 8, 12]$$$, $$$\\operatorname{gcd}(12, 18, 8, 12) \u003d 2$$$.\u003c/p\u003e\n\u003cp\u003e第三次操作后数组为$$$[12, 18, 24, 12]$$$, $$$\\operatorname{gcd}(12, 18, 24, 12) \u003d 6$$$.\u003c/p\u003e"}}]}