D. Iwanna
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Eric has developed an iwanna game. Now he invites you to participate in a test of his game.

The game map can be viewed as an $$$n$$$-node tree, connected by $$$n-1$$$ weighted edges.

In a game, the player has to walk from the starting point $$$s$$$ to the finishing point $$$t$$$. As soon as the player moves to point $$$t$$$, the game ends. Since the player does not know where the end point is, the player will follow the following strategy: Assuming that the player is currently at point $$$x$$$, if there exists an unvisited neighboring node of point $$$x$$$, the player will randomly choose one of all the unvisited neighboring nodes to go to; otherwise, the player will go to the earliest visited node among its neighboring nodes.

The cost of a single game is the sum of the weights of the visited edges on the path (multiple passes of the same edge require multiple computations).

In order to test the game, Eric asks you q questions, giving you the starting point $$$s$$$ and the end point $$$t$$$ for each question. You need to answer the expected cost for each question, computed modulo $$$998244353$$$.

Input

The first line contains two integers $$$n,q(1\le n,q \le 5\cdot 10^5)$$$.

For the next $$$n-1$$$ lines, each line contains three integers $$$u,v,w(1\le u,v \le n,1\le w \le 10^9)$$$, denoting an edge connecting u,v with weight w.

For the next $$$q$$$ lines, each line contains two integers $$$s,t(1\le s,t \le n)$$$.

Output

$$$q$$$ lines, each line contains an integer—the expected cost for each question, computed modulo $$$998244353$$$.

Examples
Input
3 3
1 2 1
2 3 2
1 2
2 3
1 3
Output
1
3
3
Input
5 5
1 2 1
1 3 2
1 4 4
1 5 8
2 1
5 1
4 5
3 4
4 4
Output
1
8
15
15
0