2991 - [2012北大校赛]Do Not Gamble

Have you ever gambled? I wish you not. Being a professional gambler for three years, I learned every trick they play. Gambling is has nothing to do with luck. It is all about cheating.One of the most elementary tricks is "mercury dice". Instead of being solid, there is a hollow chamber, filled with mercury, inside of the dice. This little modification makes the dice asymmetric, so that, the probab ility of each outcome is not equal. Imprecisely, which face is up, depends on the previous state.To simplify the model, we use "mercury coin" here. As we mentioned, the state (head or tail) after toss ing depends on the state before. The probability of that the two states are same, is p. For example, if the head side is up now, the probability that, the coin is still head up after tossing is p. And the probability that the tail side come up is 1-p. If p=0.5, it is a common coin. When p≠ 0.5, thi s coin is mercury coin. Assume the coin is head up now. After we toss Ntimes, what is the probabilit y that, the number of heads is less than a certain number K?

输入

The test file contains multiple lines, and each line is a test case. Each test cases consists of three numbers N K p N and K are integers, and p is a float number. N ≤ 30000 K ≤ N 0 ≤ p ≤ 1

输出

样例

输入

171 88 0.107

输出

0.83785
时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题