题目描述
Problem Background
In addition to donkeys, JerryC's home also has a fish tank with red carps and green carps.
Problem Description
In JerryC's fish tank, there are some red carps and green carps (no donkeys in the tank!). One night at 23:05, JerryC was bored and decided to start coding on a mysterious online judge. As a mage, JerryC could use divination to predict whether his next submission would be correct or wrong. The tool for this divination was the fish tank. Whenever JerryC's divination indicated a red carp, it meant the submission would result in a Wrong Answer (WA), adding 5 minutes to the penalty time. If it was a green carp, it would be Accepted (AC). (Of course, due to JerryC's magic, he would not be the leader of the sweet potato field. JerryC's first submission would be at the 5th minute, and unfortunately, his magic had a 5-minute cooldown period.) After each divination, JerryC would take out the carp that was divined, so that he could change the water in the tank after the competition. Now, JerryC tells you how many red carps and green carps he has at home, and asks you to calculate the expected penalty time for this competition. Note that JerryC will solve the problems in order, and penalty time is only recorded for AC submissions, which includes the time taken to AC a problem. After all the carps are used, there will be one final submission, which JerryC will not predict and will definitely be AC.
Since JerryC is stubborn, he will not switch to another problem after getting a WA, unless he gets an AC.
Input Format
One line with two positive integers, A and B, representing the number of red carps and green carps, respectively.
Output Format
One line with a positive integer, representing the expected penalty time modulo 998244853. If the result is not an integer, and can be expressed as \( \frac{P}{Q} \), then output \( P * Q^{mod-2} \% mod \).
Sample Input and Output
Sample Input #1
1 1
Sample Output #1
499122454
Sample Input #2
1 2
Sample Output #2
45
Notes
$$ 10 pts: 1 \leqslant A + B \leqslant 5 $$
$$ 30 pts: 1 \leqslant A + B \leqslant 20 $$
$$ 70 pts: 1 \leqslant A + B \leqslant 3000 $$
$$ 100 pts: 1 \leqslant A \leqslant 1e18, 1 \leqslant B \leqslant 1e7 $$
The last six test cases have a time limit of 2400ms!
Other test cases have a time limit of 400ms!
$$ \color{white}{\text{Reminder: Pay attention to the modulo number}} $$
Sample 1 Explanation:
There are two possible scenarios:
1. AC WA AC
2. WA AC AC
In the first scenario, the penalty time is 5 (AC at the 5th minute) + 5 (WA penalty of 5 minutes) + 15 (AC at the 15th minute) = 25.
In the second scenario, the penalty time is 5 (WA penalty of 5 minutes) + 10 (AC at the 10th minute) + 15 (AC at the 15th minute) = 30.
Thus, the expected penalty time is \( \frac{25+30}{2} = \frac{55}{2} \). Since we need to take the modulo, the final answer is 499122454.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分