{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"We say that a set S \u003d {x1, x2, ..., xn} is factor closed if for any xi ∈ S and any divisor d of xi we have d ∈ S. Let’s build a GCD matrix (S) \u003d (sij), where sij \u003d GCD(xi, xj) – the greatest common divisor of xi and xj. Given the factor closed set S, find the value of the determinant:\r\u003cbr\u003e\r\u003cbr\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/f0cf0ef3dffd223dd980861a7c4c67b6?v\u003d1715215974\" alt\u003d\"D_n \u003d \\left|{\\begin{array}{ccccc}gcd(x_1,x_1)\u0026amp;gcd(x_1,x_2)\u0026amp;gcd(x_1,x_3)\u0026amp;\\cdots\u0026amp;gcd(x_1,x_n)\\\\gcd(x_2,x_1)\u0026amp;gcd(x_2,x_2)\u0026amp;gcd(x_2,x_3)\u0026amp;\\cdots\u0026amp;gcd(x_2,x_n)\\\\gcd(x_3,x_1)\u0026amp;gcd(x_3,x_2)\u0026amp;gcd(x_3,x_3)\u0026amp;\\cdots\u0026amp;gcd(x_3,x_n)\\\\\\cdots\u0026amp;\\cdots\u0026amp;\\cdots\u0026amp;\\cdots\u0026amp;\\cdots\\\\gcd(x_n,x_1)\u0026amp;gcd(x_n,x_2)\u0026amp;gcd(x_n,x_3)\u0026amp;\\cdots\u0026amp;gcd(x_n,x_n)\\end{array}}\\right|\" align\u003d\"absmiddle\"\u003e\u003c/center\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input file contains several test cases. Each test case starts with an integer n (0 \u0026lt; n \u0026lt; 1000), that stands for the cardinality of S. The next line contains the numbers of S: x1, x2, ..., xn. It is known that each xi is an integer, 0 \u0026lt; xi \u0026lt; 2*10\u003csup\u003e9\u003c/sup\u003e. The input data set is correct and ends with an end of file."}},{"title":"Output","value":{"format":"HTML","content":"For each test case find and print the value Dn mod 1000000007."}},{"title":"Sample","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\u003e2 \r\n1 2 \r\n3 \r\n1 3 9 \r\n4 \r\n1 2 3 6\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 \r\n12 \r\n4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}