{"trustable":true,"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\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eDreamGrid is driving a spaceship from Mars to Earth. \u003c/p\u003e\u003cp\u003eThere are $$$n$$$ accelerators on the trajectory to accelerate the spaceship. The $$$i$$$-th accelerator has an accelerating factor of $$$a_i$$$. The spaceship will pass the accelerators one by one. Initially, the velocity of the spaceship is $$$0$$$. When the spaceship passes through an accelerator, it gains energy from the accelerator and the velocity changes. Formally, if the accelerating factor is $$$A$$$ and the velocity before accelerating is $$$v$$$, the velocity after accelerating becomes $$$v\u0027\u003d(v+1)\\times A$$$.\u003c/p\u003e\u003cp\u003eHowever, the $$$n$$$ accelerators are uniformly randomly shuffled. DreamGrid doesn\u0027t know the order of the accelerators passed through now. Can you tell him the expected velocity after passing through all the $$$n$$$ accelerators?\u003c/p\u003e\u003cp\u003eIt can be proved that the expected velocity is rational. Suppose that the answer can be denoted by $$$\\frac{u}{d}$$$ where $$$\\gcd(u, d) \u003d 1$$$, you need to output an integer $$$r$$$ such that $$$rd \\equiv u\\pmod{998\\,244\\,353}$$$ and $$$0 \\le r \u0026lt; 998\\,244\\,353$$$. It can be proved that such $$$r$$$ exists and is unique.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThere are multiple test cases. The first line of the input contains an integer $$$T$$$ ($$$1 \\le T \\le 100\\,000$$$), indicating the number of test cases. For each test case:\u003c/p\u003e\u003cp\u003eThe first line contains an integer $$$n$$$ ($$$1 \\le n \\le 100\\,000$$$), indicating the number of accelerators.\u003c/p\u003e\u003cp\u003eThe next line contains $$$n$$$ integers $$$a_1, a_2, \\cdots, a_n$$$ ($$$1 \\le a_i \\le 10^9$$$), indicating the accelerating factors.\u003c/p\u003e\u003cp\u003eIt\u0027s guaranteed that the sum of $$$n$$$ of all test cases will not exceed $$$100\\,000$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case output one line containing the integer $$$r$$$.\u003c/p\u003e"}},{"title":"Examples","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\u003e3\n3\n1 2 3\n1\n10\n4\n5 5 5 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e665496247\n10\n780\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eFor the first example, there are $$$6$$$ ways to order the accelerators:\u003c/p\u003e\u003cul\u003e \u003cli\u003e [1,2,3]: $$$v \u003d ((((0+1)\\times 1+1)\\times 2)+1)\\times 3 \u003d 15$$$ \u003c/li\u003e\u003cli\u003e [1,3,2]: $$$v \u003d ((((0+1)\\times 1+1)\\times 3)+1)\\times 2 \u003d 14$$$ \u003c/li\u003e\u003cli\u003e [2,1,3]: $$$v \u003d ((((0+1)\\times 2+1)\\times 1)+1)\\times 3 \u003d 12$$$ \u003c/li\u003e\u003cli\u003e [2,3,1]: $$$v \u003d ((((0+1)\\times 2+1)\\times 3)+1)\\times 1 \u003d 10$$$ \u003c/li\u003e\u003cli\u003e [3,1,2]: $$$v \u003d ((((0+1)\\times 3+1)\\times 1)+1)\\times 2 \u003d 10$$$ \u003c/li\u003e\u003cli\u003e [3,2,1]: $$$v \u003d ((((0+1)\\times 3+1)\\times 2)+1)\\times 1 \u003d 9$$$ \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eSo the expected velocity is $$$\\frac{15+14+12+10+10+9}{3!} \u003d \\frac{70}{6}$$$. \u003c/p\u003e"}}]}