Problem B
Con Master
Languages
en
pt
A great friend that hasn’t talked to you since high school is offering you a great opportunity on how to win money in a fast and easy way.
That offer consists of a game he will play with you. Your friend is going to draw a random integer from $1$ to $k$, with all values having the same odds of being drawn. After that the game will be as follows:
-
You guess the number that has been drawn.
-
If you guess a number greater than the one that has been drawn your friend lets you know that and you pay him $A$ dollars. If you guess a number smaller than the one that has been drawn your friend lets you know that and you pay him $B$ dollars. If you guess the right number your friend pays you $C$ dollars.
-
If you have guessed the right number the game ends, otherwise, you go back to step $1$.
You are still not sure if that game is a reliable source of income. Assuming your friend is really drawing the number in a random fashion and you will always guess the number that maximizes the expected number of dollars you get, what is the average amount of dollars you will get from playing this game once until the end?
Input
The input will be a line with the integers $k$, $A$, $B$ and $C$($1 \leq k, A, B, C \leq 10^6$), described in the statement.
Output
Print the expected amount of money you will get from the game in the form of an irreducible fraction.
Sample Input 1 | Sample Output 1 |
---|---|
8 2 2 5 |
7/4 |
Sample Input 2 | Sample Output 2 |
---|---|
7 2 3 3 |
-4/7 |
Sample Input 3 | Sample Output 3 |
---|---|
4 1 1 1 |
0/1 |