CF1493D GCD of an Array
Description
You are given an array $ a $ of length $ n $ . You are asked to process $ q $ queries of the following format: given integers $ i $ and $ x $ , multiply $ a_i $ by $ x $ .
After processing each query you need to output the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of all elements of the array $ a $ .
Since the answer can be too large, you are asked to output it modulo $ 10^9+7 $ .
Input Format
N/A
Output Format
N/A
Explanation/Hint
After the first query the array is $ [12, 6, 8, 12] $ , $ \operatorname{gcd}(12, 6, 8, 12) = 2 $ .
After the second query — $ [12, 18, 8, 12] $ , $ \operatorname{gcd}(12, 18, 8, 12) = 2 $ .
After the third query — $ [12, 18, 24, 12] $ , $ \operatorname{gcd}(12, 18, 24, 12) = 6 $ .
Here the $ \operatorname{gcd} $ function denotes the greatest common divisor.