Under construction

Still being built. Things may change

Feeder Robot

Time limit1sMemory limit1024 MB

Summary
Count the distinct (final position, pellet counts per coop) outcomes of a random walk that drops M pellets on a line of N coops from start A, mod 998244353.
Level

Medium7 of 10

Topics
Combinatorics, Math
Solved
No attempts yet

Problem

Vincent switches his retirement plan from raising horses and goats into raising chickens. He procures NN chickens and lays each of them into their own coop (hen house). The coops are placed on a single line numbered sequentially from 1 at the left-most to NN at the right-most. To make his retirement blissful (or at least he thought), Vincent buys a feeder robot. This feeder robot is to be loaded with MM pellets and it will distribute them for the chickens to feed on. The feeder robot will move from one coop to an adjacent coop and distribute 1 pellet to each coop it visits. If a coop is visited xx times by the robot including the robot's initial position, then it will get xx pellets. However, Vincent has just noticed that he cannot control how the robot moves. Let the robot be in front of coop pp. If the robot still has pellets to distribute, it will move to an adjacent coop (p−1p-1 or p+1p+1) at random and distribute 1 pellet to that coop. This process repeats until the robot has no more pellets to distribute. Note that if p=1p=1, then the robot will move to coop 2; similarly, if p=Np=N, then the robot will move to coop N−1N-1. Since Vincent dislikes you even though you are his only friend, he challenges you to a problem. The challenge is to count how many possible pellets distributions are there if the robot starts at coop AA. A pellets distribution is defined as a tuple ⟨R,S1..N⟩\langle R, S_{1..N} \rangle where RR is the final position of the robot and SiS_i is the number of pellets coop ii gets. Two distributions are different if and only if the final position of the robot differs or there is a coop that gets a different number of pellets. The robot's movement or the order when the coop gets a pellet does not matter. Since the output can be quite big, Vincent requires you to give him the non-negative remainder when the output is divided by 998 244 353. Believing that you cannot solve it, Vincent agrees to award you with a hefty reward if you managed to solve his challenge. For example, let N=4N = 4, M=3M = 3, and A=2A = 2. In this example, there are 3 different pellets distributions. ⟨2,{1,2,0,0}⟩\langle 2, \{1, 2, 0, 0\} \rangle: The robot ends at coop 2 and the number of pellets each coop gets is {1,2,0,0}\{1, 2, 0, 0\}. The robot's movement that causes this distribution is: The robot starts at coop 2 and distributes 1 pellet to coop 2; it moves to coop 1 and distributes 1 pellet to coop 1; it moves to coop 2 and distributes 1 pellet to coop 2. In a simple notation, the robot's movement is 2 → 1 → 2. ⟨2,{0,2,1,0}⟩\langle 2, \{0, 2, 1, 0\} \rangle: The robot ends at coop 2 and the number of pellets each coop gets is {0,2,1,0}\{0, 2, 1, 0\}. The robot's movement is 2 → 3 → 2. ⟨4,{0,1,1,1}⟩\langle 4, \{0, 1, 1, 1\} \rangle: The robot ends at coop 4 and the number of pellets each coop gets is {0,1,1,1}\{0, 1, 1, 1\}. The robot's movement is 2 → 3 → 4.

Input

Input contains three integers NN, MM, and AA (2 ≤ NN ≤ 100 000; 1 ≤ MM ≤ 200 000; 1 ≤ AA ≤ NN), representing the number of coops, the number of pellets, and the starting position of the feeder robot.

Output

Output contains one integer on a line: the non-negative remainder when the number of different pellets distributions is divided by 998 244 353.

Examples3

  1. Example 1

    Input
    4 3 2
    
    Expected output
    3
    
  2. Example 2

    Input
    3 5 2
    
    Expected output
    3
    
  3. Example 3

    Input
    3 6 2
    
    Expected output
    6