#P12735. 回报

    ID: 11571 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2025洛谷原创组合数学容斥原理快速数论变换 NTT洛谷月赛

回报

Description

Yuta needs to help Saki find suitable study music.

He has found an album containing nn songs, numbered from 11 to nn. Playing each song takes exactly 11 minute. Saki has two courses, A and B, that she needs to study, and each time she study for A and B takes aa and bb minutes, respectively. To better assist her, Yuta plans to rearrange the order in which the songs are played. Specifically, he wants to choose a permutation p1,,pnp_1, \dots, p_n of length nn such that there exist two cycles AA and BB of lengths aa and bb, respectively, and every element in AA is less than every element in BB.

In a permutation, a cycle CC of length kk is a sequence c1,,ckc_1, \dots, c_k composed of different integers, where 1c1n1 \leq c_1 \leq n, ci+1=pcic_{i+1} = p_{c_i} for i=1,,k1i = 1, \dots, k-1, and pck=c1p_{c_k} = c_1.

Yuta wants to determine how many such permutations pp exist. Since the answer could be very large, you only need to provide the result modulo 998244353998244353.

Input Format

Input a single line containing three integers representing the sequence length nn and a,ba, b.

Output Format

Output a single integer on a line, indicating the number of permutations that satisfy the requirements, modulo 998244353998244353.

4 2 1

3

678 12 34

951781526

1987 654 321

27905503

1000000 13 20

912829543

Hint

Sample 1 Explanation

The permutations that satisfy the requirements are (2,1,3,4)(2,1,3,4), (3,2,1,4)(3,2,1,4), and (1,3,2,4)(1,3,2,4), totaling 33 permutations.

Constraints

This problem enables subtask scoring and subtask dependence, with the constraints and scores for each subtask as follows.

Subtask No. nn\le Special Constraint Score Depends on Subtask
11 1010 Yes 77
22 700700 1010 11
33 No 2020 1,21,2
44 20002000 Yes 1010
55 No 3030 1,2,3,41,2,3,4
66 10610^6 Yes 2020 1,2,41,2,4
77 No 33 1,2,3,4,5,61,2,3,4,5,6

Special constraint: min(a,b)=1\min(a,b)=1.

For all of the testdata, 1n1061\le n\le10^6, 1a,b<a+bn1\le a,b<a+b\le n.