Under construction

Still being built. Things may change

One Goal

Time limit2sMemory limit512 MB

Summary
Given a tree of n cities and k friends, sum the smallest optimal meeting city over all n^k placements of the friends, modulo 998244353.
Level

Hard9 of 10

Topics
Combinatorics, Tree, Math, Dynamic programming
Solved
No attempts yet

Problem

There are nn cities and n−1n - 1 roads in the Republic of Never. The cities are numbered from 1 to nn. Every road connects two cities and can be traversed in both directions. Any two cities can reach each other using the roads. The distance d(u,v)d(u, v) is the smallest number of roads needed to travel from city uu to city vv.

There are kk friends who want to meet. The ii-th friend lives in city aia_i. The friends choose city vv such that ∑i=1kd(v,ai)\sum_{i=1}^{k}{d(v, a_i)} is minimum. If several cities achieve this minimum, they choose the one with the smallest number.

You do not know where the friends live. Each friend may live in any of the nn cities, so there are nkn^k possible cases. Find the sum of the numbers of the cities the friends choose over all nkn^k cases. Print the sum modulo 998244353.

Input

The first line contains two integers nn and kk (2≤n,k≤300002 \le n, k \le 30000). Each of the following n−1n - 1 lines contains two integers uiu_i and viv_i (1≤ui,vi≤n1 \le u_i, v_i \le n, ui≠viu_i \ne v_i), the numbers of the cities connected by the ii-th road. It is guaranteed that any two cities can reach each other using the roads.

Output

Print the sum of the numbers of the chosen cities over all nkn^k cases, modulo 998244353.

Hint

In the first example, there are 3 cities and 2 friends, so there are 32=93^2 = 9 cases. In three of them, both friends live in the same city, and they choose that city. In the other six, the friends live in different cities, and they choose city 1. The total is (1+2+3)+6⋅1=12(1 + 2 + 3) + 6 \cdot 1 = 12.

Examples2

  1. Example 1

    Input
    3 2
    1 2
    1 3
    
    Expected output
    12
    
  2. Example 2

    Input
    5 3
    2 4
    5 3
    1 3
    3 2
    
    Expected output
    357