{"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$$$。\u003c/p\u003e\n\n\u003cp\u003e处理完每个查询后,你需要输出数组 $$$a$$$ 中所有元素的最大公约数 (GCD)。\u003c/p\u003e\n\n\u003cp\u003e由于答案可能会很大,所以请输出它对 $$$10^9+7$$$ 取模的结果。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含两个整数 $$$n,q$$$ $$$(1 \\le n, q \\le 2 \\cdot 10^5)$$$。\u003c/p\u003e\n\n\u003cp\u003e第二行包含 $$$n$$$ 个整数 $$$a_1, a_2, \\ldots, a_n$$$ $$$(1 \\le a_i \\le 2 \\cdot 10^5)$$$,表示变化前数组 $$$a$$$ 的元素。\u003c/p\u003e\n\n\u003cp\u003e接下来的 $$$q$$$ 行包含以下格式的查询:每行包含两个整数 $$$i,x$$$ $$$(1 \\le i \\le n,~1 \\le x \\le 2 \\cdot 10^5)$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e输出 $$$q$$$ 行:处理完每个查询后,在单独的一行上输出所有元素的最大公约数,结果对 $$$10^9+7$$$ 取模。\u003c/p\u003e"}},{"title":"示例 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"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e第一个查询后,数组为 $$$[12, 6, 8, 12]$$$, $$$\\text{gcd}(12, 6, 8, 12) \u003d 2$$$。\u003c/p\u003e\n\n\u003cp\u003e第二个查询后,数组为 $$$[12, 18, 8, 12]$$$, $$$\\text{gcd}(12, 18, 8, 12) \u003d 2$$$。\u003c/p\u003e\n\n\u003cp\u003e第三个查询后,数组为 $$$[12, 18, 24, 12]$$$, $$$\\text{gcd}(12, 18, 24, 12) \u003d 6$$$。\u003c/p\u003e\n\n\u003cp\u003e这里的 $$$\\text{gcd}$$$ 函数表示最大公约数。\u003c/p\u003e"}}]}