Under construction

Still being built. Things may change

Nam Hyeon-uk

Time limit2sMemory limit1024 MB

Summary
Given n and m (0 to 3), sum the inversion counts of all length-n permutations with exactly m increasing subsequences of length 3, mod 998244353.
Level

Hard8 of 10

Topics
Combinatorics, Math, Dynamic programming
Solved
No attempts yet

Problem

Nam Hyeon-uk could not solve this problem.

Among all permutations of length nn, count those with exactly mm increasing subsequences (increasing subsequence) of length 3, and print the count modulo 998,244,353.

But Nam Hyeon-uk could not solve this problem.

So instead of counting the sequences, he wants to compute the sum of the inversion counts (inversion) of those sequences.

Print the answer to the problem Nam Hyeon-uk changed, modulo 998,244,353.

Input

The first line contains two integers nn and mm. (1≤n≤1000001 \le n \le 100000, 0≤m≤30 \le m \le 3)

Output

Print the answer on the first line.

Examples5

  1. Example 1

    Input
    2 0
    
    Expected output
    1
    
  2. Example 2

    Input
    3 2
    
    Expected output
    0
    
  3. Example 3

    Input
    4 2
    
    Expected output
    3
    
  4. Example 4

    Input
    5 0
    
    Expected output
    290
    
  5. Example 5

    Input
    10 3
    
    Expected output
    1867456