#P6475. City Landmarks

    ID: 19689 Type: Default 1000ms 256MiB

City Landmarks

City Landmarks

BallBall is an architect who has been assigned by the mayor to build a city with 2n skyscrapers. He plans to number the skyscrapers from 1 to 2n from left to right. The construction plan must satisfy the following conditions:

  • Each skyscraper's height is a positive integer no more than m.
  • The first n skyscrapers (positions 1 to n) must form a non-decreasing sequence, i.e. \(a_1 \le a_2 \le \cdots \le a_{n}\).
  • The last n skyscrapers (positions n+1 to 2n) must form a non-increasing sequence, i.e. \(a_{n+1} \ge a_{n+2} \ge \cdots \ge a_{2n}\).
  • BallBall intends to choose two skyscrapers with indices x and y as the city landmarks. He believes the city is beautiful only if the two chosen skyscrapers have the same height, i.e. \(a_x = a_y\).

The mayor would like to know how many construction plans satisfy these properties. Two plans are different if and only if there exists at least one skyscraper whose height differs between the two plans. Since the answer can be very large, output it modulo \(998244353\).

Note: In the context of the problem, the condition on the landmarks implies that the overall plan must have at least one pair of skyscrapers with equal height.

inputFormat

The input consists of a single line containing two integers n and m \((1 \leq n \leq m)\).

outputFormat

Output a single integer, the number of valid construction plans modulo \(998244353\).

sample

1 1
1