100 atcoder#AGC019F. [AGC019F] Yes or No
[AGC019F] Yes or No
Score : points
Problem Statement
You are participating in a quiz with questions and Yes/No answers.
It's known in advance that there are questions with answer Yes and questions with answer No, but the questions are given to you in random order.
You have no idea about correct answers to any of the questions. You answer questions one by one, and for each question you answer, you get to know the correct answer immediately after answering.
Suppose you follow a strategy maximizing the expected number of correct answers you give.
Let this expected number be , an irreducible fraction. Let . It can be proven that a unique integer between and exists such that modulo , and it is equal to modulo , where is the modular inverse of . Find .
Constraints
- Both and are integers.
Partial Score
- points will be awarded for passing the testset satisfying and .
Input
Input is given from Standard Input in the following format:
Output
Let be the expected number of correct answers you give if you follow an optimal strategy, represented as an irreducible fraction. Print modulo .
1 1
499122178
There are two questions. You may answer randomly to the first question, and you'll succeed with 50% probability. Then, since you know the second answer is different from the first one, you'll succeed with 100% probability.
The expected number of your correct answers is / . Thus, , , (modulo ), and (again, modulo ).
2 2
831870297
The expected number of your correct answers is / .
3 4
770074220
The expected number of your correct answers is / .
10 10
208827570
42 23
362936761