P4773 Red Carp and Green Carp

Background

In JerryC’s home, besides a donkey, there is also a fish tank with red carp and green carp.

Description

In JerryC’s fish tank, there are some red carp and green carp (there is no donkey in the fish tank!). At 23:05 tonight, JerryC was bored, so he opened some mysterious OJ and started grinding hard. As a “mo$%$” mage, JerryC can know in advance whether his next submission will be correct or wrong through divination. Of course, the tool for divination is the fish tank in front of him. Whenever JerryC’s divination points to a red carp, it means this submission will be WA, and 5 min of penalty time will be added; if it points to a green carp, it will be AC. (Of course, due to JerryC’s “mo$%$” magic, JerryC will not be “番薯田扛把子” (fan shu tian kang ba zi). JerryC’s first submission will be at the 5th min, and unfortunately, JerryC’s “mo$%$” magic has a 5 min cooldown.) Also, after each divination, JerryC will take the carp he divined out of the tank, so that after the contest he can change the water (~~change his taste~~). Now JerryC tells you how many red carp and green carp he has at home. Please tell him the expected total penalty time for this contest. JerryC will solve problems in order, and penalty time is recorded only for problems that are AC. When calculating penalty time, you need to add the time of AC, and after all carp are used up, he will submit once more. For this last submission, JerryC will not do any prediction and it will definitely be AC. Because JerryC is quite stubborn, he will not switch to another problem after getting WA on a problem, unless he gets AC.

Input Format

One line with two positive integers $A, B$, representing the number of red carp and green carp, respectively.

Output Format

One line with one positive integer, representing the expected penalty time modulo $998244853$. If the result is not an integer, and it can be written as $\frac{P}{Q}$, then output $P \times Q^{mod-2} \bmod mod$.

Explanation/Hint

### Sample Explanation \#1 There are two possibilities: 1. AC WA AC; 2. WA AC AC. In the first case, the penalty time is $5$ (AC at the 5th minute) $\!+ \ 5$ (one WA adds 5 minutes of penalty) $\!+ \ 15$ (AC at the 15th minute) $= 25$. In the second case, the penalty time is $5$ (one WA adds 5 minutes of penalty) $\!+ \ 10$ (AC at the 10th minute) $\!+ \ 15$ (AC at the 15th minute) $= 30$. So the expected penalty time is $ \frac{25+30}{2} = \frac{55}{2} $. We need to take the fraction modulo, so the final answer is $499122454$. ### Constraints - 10 pts: $1 \le A + B \le 5$; - 30 pts: $1 \le A + B \le 20$; - 70 pts: $1 \le A + B \le 3000$; - 100 pts: $1 \le A \le 10 ^ {18}$, $1 \le B \le 10 ^ 7$. The time limit for the last six subtasks is 2400 ms, and for the other subtasks it is 400 ms. $$\color{white}{\text{Warm reminder: pay attention to the modulus}}$$ Translated by ChatGPT 5