Hello 2018 |
---|
Finished |
There is a chess tournament in All-Right-City. n players were invited to take part in the competition. The tournament is held by the following rules:
The players are enumerated with integers from 1 to n. The enumeration was made using results of a previous tournament. It is known that player i wins player j (i < j) with probability p.
You need to help to organize the tournament. Find the expected value of total number of games played by all the players.
It can be shown that the answer can be represented as , where P and Q are coprime integers and . Print the value of P·Q - 1 modulo 998244353.
If you are not familiar with any of the terms above, you can read about them here.
The first line of input contains a single integer n (2 ≤ n ≤ 2000) — the number of players.
The second line contains two integers a and b (1 ≤ a < b ≤ 100) — the numerator and the denominator of fraction .
In the only line print the expected value of total number of games played by all the players. Print the answer using the format above.
3
1 2
4
3
4 6
142606340
4
1 2
598946623
In the first example the expected value is 4.
In the second example the expected value is .
In the third example the expected value is .
Name |
---|