{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eGiven three sequences $a \u003d [a_1,a_2,...a_n]$, $b\u003d [b_1,b_2,...b_n]$ and $c\u003d[c_1,c_2,...c_n]$ each containing $n$ non-negative integers. You need to compute the value of $\\displaystyle\\sum_{p\u003d1}^n\\sum_{k\u003d1}^{+\\infty }d_{p,k}*c_{p}^k$.\u003cbr\u003e\u003cbr\u003eAnd the sequence $d\u003d[d_{p,1},d_{p,2}...d_{p,n}]$ is calculated by the following rule: \u003cbr\u003e\u003cbr\u003e\u0026amp;#8203;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;For every integer $p$ $(1\\le p\\le n)$, every integer $k$ $(1\\le k\\le n)$, $\\displaystyle d_{p,k}\u003d\\sum_{k\u003di\\oplus j}a_i*b_j$, **(the range of $i$, $j$ is $1\\le i\\le \\frac{n}{p}$, $1\\le j\\le \\frac{n}{p}$)**. Wherein,the notation $\\oplus$ represents an operation in which the value of each bit of $K$ in the ternary representation is equal to the greatest common divisor of the corresponding bit of $I$, $J$ in the ternary representation. Formally speaking, decimal numbers $(K)_{10}$, $(I)_{10},$ $(J)_{10}$ can be respectively represented as three ternary numbers $(k_{m-1}k_{m-2}...k_0)_3$, $(i_{m-1}i_{m-2}...i_0)_3$, $(j_{m-1}j_{m-2}...j_0)_3$ . For every integer $t$ in $(1\\le t\\le m)$, $k_t\u003dgcd(i_t,j_t)$, where $gcd(x, y)$ is the greatest common divisor of $x$ and $y$, specially, we define that $gcd(x,0)\u003dgcd(0,x)\u003dx$. For example, if $x\u003d(5)_{10}\u003d(012)_3$, $y\u003d(10)_{10}\u003d(101)_3$, then $k\u003d(111)_3\u003d(13)_{10}$\u003cbr\u003e\u003cbr\u003eOutput the answer mod $10^9+7$. \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There is only one test case for this question.\u003cbr\u003e\u003cbr\u003eThe first line contains an integer $n$ $(n≤2*10^5)$ — length of the sequence $a,b,c$.\u003cbr\u003e\u003cbr\u003eThe second line contains $n$ integers $a_1,a_2,…,a_n$ $(1≤a_i≤10^9)$.\u003cbr\u003e\u003cbr\u003eThe third line contains $n$ integers $b_1,b_2,…,b_n$ $(1≤b_i≤10^9)$.\u003cbr\u003e\u003cbr\u003eThe fourth line contains $n$ integers $c_1,c_2,…,c_n$ $(1≤c_i≤10^9)$.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Print an integer, which is the answer modulo $10^9+7$"}},{"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\u003e4\r\n2 3 4 5\r\n1 2 3 4\r\n9 8 7 6\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1643486\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}