Odds On


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

Tom and Ray are facing off in an epic game of chance!

The game is played with a running "score" and a special coin that has a positive integer printed on each side. Tom and Ray take turns flipping the coin. After each flip, the number that lands face-up is added to the score.

Ray wins if the score ever becomes exactly s at any point during the game. Tom wins if the score passes s.

What is the probability that Ray will win the game?

Input

The first line contains two integers a and b (1 \leq a, b \leq 10^8), the numbers on each side of the coin.

The second line contains an integer s (1 \leq s \leq 10^5), the score Ray must reach to win.

Output

Output the probability that Ray will win the game, correct to 4 decimal places.

Examples

Input 1
1 2
2
Output 1
0.7500

Ray can win in 2 ways:

  • If a 2 is flipped on the first turn (1/2 probability).
  • If a 1 is flipped on the first turn, and again on the second (1/4 probability).

Therefore, he has a 1/4 + 1/2 = 3/4 probability of winning.

Input 2
2 3
5
Output 2
0.5000

Ray can win in 2 ways:

  • If a 2 is flipped on the first turn, and a 3 is flipped on the second (1/4 probability).
  • If a 3 is flipped on the first turn, and a 2 is flipped on the second (1/4 probability).

Therefore, he has a 1/4 + 1/4 = 1/2 probability of winning.

Input 3
10 10
5
Output 3
0.0000

There is no way for Ray to win.


Comments

There are no comments at the moment.