Coin Toss
Practice
5 (1 votes)
Easy
Problem
45% Success 317 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Messi and Ronaldo finally decide to see who is the greatest player by means of a game. And this time they don't play a game of football, rather a game of chance. In this game there is a ball O which is initially with Messi . Each of them has a biased coin with them. Now in one game they play k rounds. In each round whichever of them has the ball tosses their coin. If it’s heads then he passes the ball to the other one, if it’s tails then he keeps the ball. After the completion of the rounds whoever has the ball wins.

If they play the game \( 10^k \) times then find the expected number of times Ronaldo would win mod \( 10^9 + 7 \) . It is guaranteed that the expectation value would be an integer. Assume that the probability of heads coming on Messi’s coin is \( \frac{p_1}{10} \) and Ronaldo’s coin is \( \frac{p_2}{10} \) .

Input:

Single line containing three space separated integers \( p_1 , p_2 , k \) .

Output:

Single Integer that is the answer to the problem.

Constraints;

\( 1 \leq p_1 \leq p_2 \leq 9 \)

\( 1 \leq k \leq 10^{18} \)

Useful Links: Modulo, Expectation Value

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
Easy