小兰很喜欢随机数。
TA 首先选定了一个实数 ,然后生成了 个随机数 ,每个数是独立按照如下方式生成的:
生成完这些随机数之后,小艾对这个数列求了前缀和,得到了数列 。
给定 ,小兰想知道,期望有多少 落在 内?
Ran loves random numbers.
Ran first selects a real number and then generates random numbers , each of which is generated independently as follows:
After generating these random numbers, Ai summed the prefixes of this series to get the series .
Given , Lan wants to know how many are expected to fall within ?
输入
一行输入四个数 。保证 , 的位数不超过 。
Enter four numbers on a line. Ensure that and has no more than digits.
输出
输出一个实数,表示答案。你需要保证答案的绝对或相对误差不超过 。
Output a real number representing the answer. You need to ensure that the absolute or relative error of the answer does not exceed .
样例
标准输入 复制文本 |
3 0.5 1 2 |
标准输出 复制文本 |
1.000000 |
提示
有 的概率, 而 ,此时只有 落在 内。
有 的概率, 且 ,此时 落在 内。
有 的概率,,此时只有 落在 内。
所以期望是 。
With probability, and , only falls within .
With probability, and , then fall in .
There is a probability that , when only falls within .
So the expectation is .