#MSOLUTIONS2019C. Best-of-(2n-1)

Best-of-(2n-1)

Score : 500500 points

Problem Statement

Takahashi and Aoki will play a game. They will repeatedly play it until one of them have NN wins in total.

When they play the game once, Takahashi wins with probability AA %, Aoki wins with probability BB %, and the game ends in a draw (that is, nobody wins) with probability CC %. Find the expected number of games that will be played, and print it as follows.

We can represent the expected value as P/QP/Q with coprime integers PP and QQ. Print the integer RR between 00 and 109+610^9+6 (inclusive) such that R×QP(mod109+7)R \times Q \equiv P\pmod {10^9+7}. (Such an integer RR always uniquely exists under the constraints of this problem.)

Constraints

  • 1N1000001 \leq N \leq 100000
  • 0A,B,C1000 \leq A,B,C \leq 100
  • 1A+B1 \leq A+B
  • A+B+C=100A+B+C=100
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN AA BB CC

Output

Print the expected number of games that will be played, in the manner specified in the statement.

1 25 25 50
2

Since N=1N=1, they will repeat the game until one of them wins. The expected number of games played is 22.

4 50 50 0
312500008

CC may be 00.

1 100 0 0
1

BB may also be 00.

100000 31 41 28
104136146