#P7616. [COCI 2011/2012 #2] ZADAĆA
[COCI 2011/2012 #2] ZADAĆA
Description
Given positive integers and positive integers , compute:
$$\gcd(\prod\limits_{i=1}^N A_i, \prod\limits_{i=1}^M B_i)$$Input Format
The first line contains a positive integer .
The second line contains positive integers .
The third line contains a positive integer .
The fourth line contains positive integers .
Output Format
Output one line containing the answer. If the answer has more than nine digits, you only need to output its last nine digits.
3
2 3 5
2
4 5
10
4
6 2 3 4
1
1
1
3
358572 83391967 82
3
50229961 1091444 8863
000012028
Hint
Sample 1 Explanation
, so the answer is .
Constraints
For of the testdata, , and .
Notes
The scoring of this problem follows the original COCI problem settings, with a full score of .
This problem is translated from COCI2011-2012 CONTEST #2 T3 ZADAĆA。
Translated by ChatGPT 5
京公网安备 11011102002149号