#P10376. [GESP202403 六级] 游戏
[GESP202403 六级] 游戏
Background
Related multiple-choice and true/false problems: https://ti.luogu.com.cn/problemset/1146.
Problem Description
You have four positive integers , and you plan to use them to play a simple game.
In one move of the game, you may choose to subtract from , or subtract from . The game consists of multiple moves and ends when .
You want to know how many different sequences of moves there are when the game ends. Two move sequences are different if and only if the number of moves is different, or in some move one sequence chooses to subtract from while the other chooses to subtract from . If , subtracting and subtracting are still considered different moves.
Since the answer may be very large, you only need to output the result modulo .
Input Format
One line containing four integers .
Output Format
Output one line with one integer representing the answer.
1 1 1 1
1
114 51 4 1
176
114514 191 9 810
384178446
Hint
Constraints
- For of the testdata, , and .
- For of the testdata, , and .
- For all testdata, it is guaranteed that .
Translated by ChatGPT 5