Classical Summation Problem

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

There are nn cities and n1n-1 roads in the Republic of Never. The cities are conveniently numbered from 11 to nn. The roads are numbered from 11 to n1n-1, and road ii connects cities ii and i+1i + 1. Every road can be traversed in both directions. The distance d(u,v)=uvd(u, v) = |u - v| is defined as the smallest number of roads one needs to use to move from city uu to city vv.

There are kk friends who are looking to meet. The ii-th friend lives in city a_ia\_i. For the meeting, the friends will choose city vv such that _i=1kd(v,a_i)\sum \limits\_{i=1}^k d(v, a\_i) is minimum. If there are several such cities, they will choose the one with the smallest number among them.

Unfortunately, you know just the number of friends but nothing about the cities where they live. Every friend might live in any of the nn cities; hence, there are nkn^k options overall. You would like to find the sum of the numbers of cities the friends will choose in all the nkn^k options. Output this sum modulo 998,244,353998\\,244\\,353.

입력

The only line contains two integers nn and kk, denoting the number of cities and the number of friends (2n,k1062 \le n, k \le 10^6).

출력

Print the sum of the numbers of cities the friends will choose in all the nkn^k options, modulo 998,244,353998\\,244\\,353.

힌트

In the first example, with three cities and two friends, there are 32=93^2 = 9 options to consider. If either friend lives in city 11, the friends will choose city 11, and there are 55 such options. Otherwise, if either friend lives in city 22, the friends will choose city 22, and there are 33 such options. In the remaining case, if both friends live in city 33, they will choose city 33, and there is 11 such option. The total is 51+32+13=145 \cdot 1 + 3 \cdot 2 + 1 \cdot 3 = 14.