#abc360e. E - Random Swaps of Balls

E - Random Swaps of Balls

Score : 450450 points

问题陈述

N1N - 1 个白球和一个黑球。这 NN 个球排成一行,黑球最初位于最左边的位置。

高桥将执行以下操作恰好 KK 次。

  • 随机选择两个整数,分别在 11NN(包括 11NN)之间,记为 aabb。如果 aba \neq b,则交换从左边数第 aa 个和第 bb 个球。

经过 KK 次操作后,黑球位于从左边数第 xx 个位置。求 xx 的期望值,对 998244353998244353 取模。

998244353998244353 模下的期望值是多少?可以证明,所求的期望值总是有理数。此外,在这个问题的约束条件下,可以证明如果这个值表示为最简分数 PQ\frac{P}{Q},那么 Q≢0(mod998244353)Q \not \equiv 0 \pmod{998244353}。因此,存在一个唯一的整数 RR 使得 $R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353$。报告这个 RR

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

There are N1N - 1 white balls and one black ball. These NN balls are arranged in a row, with the black ball initially at the leftmost position.

Takahashi will perform the following operation exactly KK times.

  • Choose an integer uniformly at random between 11 and NN, inclusive, twice. Let aa and bb the chosen integers. If aba \neq b, swap the aa-th and bb-th balls from the left.

After KK operations, let the black ball be at the xx-th position from the left. Find the expected value of xx, modulo 998244353998244353.

What is expected value modulo 998244353998244353? It can be proved that the sought expected value will always be rational. Additionally, under the constraints of this problem, it can be proved that if this value is expressed as an irreducible fraction PQ\frac{P}{Q}, then Q≢0(mod998244353)Q \not \equiv 0 \pmod{998244353}. Therefore, there exists a unique integer RR such that $R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353$. Report this RR.

Constraints

  • 1N9982443521 \leq N \leq 998244352
  • 1K1051 \leq K \leq 10^5

Input

The input is given from Standard Input in the following format:

NN KK

Output

Print the answer in one line.

Sample Input 1

2 1

Sample Output 1

499122178

After one operation, the probabilities that the black ball is at the 1st position and the 2nd position from the left are both 12\displaystyle \frac{1}{2}. Thus, the expected value is 32\displaystyle \frac{3}{2}.

Sample Input 2

3 2

Sample Output 2

554580198

Sample Input 3

4 4

Sample Output 3

592707587