![](http://img.atcoder.jp/assets/top/img/flag-lang/ja.png)
![](http://img.atcoder.jp/assets/top/img/flag-lang/en.png)
Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 400 点
問題文
袋の中に金貨が A 枚、銀貨が B 枚、銅貨が C 枚入っています。
袋の中にあるいずれかの種類の硬貨が 100 枚になるまで以下の操作を繰り返します。
操作:袋の中から硬貨をランダムに 1 枚取り出す。(どの硬貨も等確率で選ばれる。) 取り出した硬貨と同じ種類の硬貨を 2 枚袋に戻す。
操作回数の期待値を求めてください。
制約
- 0 \leq A,B,C \leq 99
- A+B+C \geq 1
入力
入力は以下の形式で標準入力から与えられる。
A B C
出力
操作回数の期待値を出力せよ。正しい値との絶対誤差または相対誤差が 10^{-6} 以下であれば正解とみなされる。
入力例 1
99 99 99
出力例 1
1.000000000
1 回目の操作でどの硬貨を取り出しても、取り出した種類の硬貨が 100 枚になります。
入力例 2
98 99 99
出力例 2
1.331081081
1 回目の操作で金貨を取り出したときのみ 2 回の操作を行います。 よって期待値は 2\times \frac{98}{98+99+99}+1\times \frac{99}{98+99+99}+1\times \frac{99}{98+99+99}=1.331081081\ldots となります。
入力例 3
0 0 1
出力例 3
99.000000000
操作を行うごとに銅貨が 1 枚ずつ増えていきます。
入力例 4
31 41 59
出力例 4
91.835008202
Score : 400 points
Problem Statement
We have a bag containing A gold coins, B silver coins, and C bronze coins.
Until the bag contains 100 coins of the same color, we will repeat the following operation:
Operation: Randomly take out one coin from the bag. (Every coin has an equal probability of being chosen.) Then, put back into the bag two coins of the same kind as the removed coin.
Find the expected value of the number of times the operation is done.
Constraints
- 0 \leq A,B,C \leq 99
- A+B+C \geq 1
Input
Input is given from Standard Input in the following format:
A B C
Output
Print the expected value of the number of times the operation is done. Your output will be accepted if its absolute or relative error from the correct value is at most 10^{-6}.
Sample Input 1
99 99 99
Sample Output 1
1.000000000
No matter what coin we take out in the first operation, the bag will contain 100 coins of that kind.
Sample Input 2
98 99 99
Sample Output 2
1.331081081
We will do the second operation only if we take out a gold coin in the first operation. Thus, the expected number of operations is 2\times \frac{98}{98+99+99}+1\times \frac{99}{98+99+99}+1\times \frac{99}{98+99+99}=1.331081081\ldots
Sample Input 3
0 0 1
Sample Output 3
99.000000000
Each operation adds a bronze coin.
Sample Input 4
31 41 59
Sample Output 4
91.835008202