#P1625. Summation of Reciprocals of Consecutive Products
Summation of Reciprocals of Consecutive Products
Summation of Reciprocals of Consecutive Products
Recall that when Gauss was young, he derived the formula for the sum of the first n positive integers,
$$\sum_{i=1}^n i = \frac{n\times(n+1)}{2}.$$
Similarly, LT once computed
$$\sum_{i=1}^{n-1} \frac{1}{i\times(i+1)} = 1 - \frac{1}{n},$$
Now, as you are still a young prodigy, your task is to compute the following sum:
$$\sum_{i=1}^n \frac{1}{\prod_{j=i}^{i+m-1}j} = S,$$
where the expression
$$\prod_{j=i}^{i+m-1}j$$
denotes the product of m consecutive integers starting from i.
Print the value of S in fixed-point notation with exactly 6 decimal places.
inputFormat
The input consists of a single line with two positive integers n and m separated by a space.
outputFormat
Output the computed value of S with exactly 6 digits after the decimal point.
sample
1 1
1.000000