{"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\u003eHanh is a famous biologist. He loves growing trees and doing experiments on his own garden.\u003c/p\u003e\u003cp\u003eOne day, he got a tree consisting of $$$n$$$ vertices. Vertices are numbered from $$$1$$$ to $$$n$$$. A tree with $$$n$$$ vertices is an undirected connected graph with $$$n-1$$$ edges. Initially, Hanh sets the value of every vertex to $$$0$$$.\u003c/p\u003e\u003cp\u003eNow, Hanh performs $$$q$$$ operations, each is either of the following types: \u003c/p\u003e\u003cul\u003e \u003cli\u003e Type $$$1$$$: Hanh selects a vertex $$$v$$$ and an integer $$$d$$$. Then he chooses some vertex $$$r$$$ \u003cspan class\u003d\"tex-font-style-bf\"\u003euniformly at random\u003c/span\u003e, lists all vertices $$$u$$$ such that the path from $$$r$$$ to $$$u$$$ passes through $$$v$$$. Hanh then increases the value of all such vertices $$$u$$$ by $$$d$$$. \u003c/li\u003e\u003cli\u003e Type $$$2$$$: Hanh selects a vertex $$$v$$$ and calculates the expected value of $$$v$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eSince Hanh is good at biology but not math, he needs your help on these operations.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \\leq n, q \\leq 150\\,000$$$)\u0026nbsp;— the number of vertices on Hanh\u0027s tree and the number of operations he performs.\u003c/p\u003e\u003cp\u003eEach of the next $$$n - 1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \\leq u, v \\leq n$$$), denoting that there is an edge connecting two vertices $$$u$$$ and $$$v$$$. It is guaranteed that these $$$n - 1$$$ edges form a tree.\u003c/p\u003e\u003cp\u003eEach of the last $$$q$$$ lines describes an operation in either formats: \u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$1$$$ $$$v$$$ $$$d$$$ ($$$1 \\leq v \\leq n, 0 \\leq d \\leq 10^7$$$), representing a first-type operation. \u003c/li\u003e\u003cli\u003e $$$2$$$ $$$v$$$ ($$$1 \\leq v \\leq n$$$), representing a second-type operation. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eIt is guaranteed that there is at least one query of the second type.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each operation of the second type, write the expected value on a single line. \u003c/p\u003e\u003cp\u003eLet $$$M \u003d 998244353$$$, it can be shown that the expected value can be expressed as an irreducible fraction $$$\\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \\not \\equiv 0 \\pmod{M}$$$. Output the integer equal to $$$p \\cdot q^{-1} \\bmod M$$$. In other words, output such an integer $$$x$$$ that $$$0 \\le x \u0026lt; M$$$ and $$$x \\cdot q \\equiv p \\pmod{M}$$$.\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\u003e5 12\n1 2\n1 3\n2 4\n2 5\n1 1 1\n2 1\n2 2\n2 3\n2 4\n2 5\n1 2 2\n2 1\n2 2\n2 3\n2 4\n2 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n199648871\n399297742\n199648871\n199648871\n598946614\n199648873\n2\n2\n2\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\u003eThe image below shows the tree in the example:\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" height\u003d\"265px\" src\u003d\"CDN_BASE_URL/d0bec2e8c01c1399f519bdcc9d440e37?v\u003d1714925606\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\" width\u003d\"265px\"\u003e \u003c/center\u003e\u003cp\u003eFor the first query, where $$$v \u003d 1$$$ and $$$d \u003d 1$$$: \u003c/p\u003e\u003cul\u003e \u003cli\u003e If $$$r \u003d 1$$$, the values of all vertices get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 2$$$, the values of vertices $$$1$$$ and $$$3$$$ get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 3$$$, the values of vertices $$$1$$$, $$$2$$$, $$$4$$$ and $$$5$$$ get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 4$$$, the values of vertices $$$1$$$ and $$$3$$$ get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 5$$$, the values of vertices $$$1$$$ and $$$3$$$ get increased. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eHence, the expected values of all vertices after this query are ($$$1, 0.4, 0.8, 0.4, 0.4$$$).\u003c/p\u003e\u003cp\u003eFor the second query, where $$$v \u003d 2$$$ and $$$d \u003d 2$$$: \u003c/p\u003e\u003cul\u003e \u003cli\u003e If $$$r \u003d 1$$$, the values of vertices $$$2$$$, $$$4$$$ and $$$5$$$ get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 2$$$, the values of all vertices get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 3$$$, the values of vertices $$$2$$$, $$$4$$$ and $$$5$$$ get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 4$$$, the values of vertices $$$1$$$, $$$2$$$, $$$3$$$ and $$$5$$$ get increased. \u003c/li\u003e\u003cli\u003e If $$$r \u003d 5$$$, the values of vertices $$$1$$$, $$$2$$$, $$$3$$$ and $$$4$$$ get increased. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eHence, the expected values of all vertices after this query are ($$$2.2, 2.4, 2, 2, 2$$$).\u003c/p\u003e"}}]}