#P1625. 求和

求和

Description

When Gauss was still a kid, he found that

i=1ni=n×(n+1)2.\sum_{i=1}^n i= \frac{n \times (n+1)}{2}.

When LT was still a kid, he found that

$$\sum_{i=1}^{n-1} \frac{1}{i\times (i+1)}=1-\frac{1}{n}.$$

Now, while you are still a kid, you need to compute:

i=1n1j=ii+m1j=S.\sum_{i=1}^n \frac{1}{\prod_{j=i}^{i+m-1}j}=S.

Input Format

Input two integers n,mn, m.

Output Format

Output two lines. The first line contains an integer XX, and the second line contains an integer YY, indicating that S=XYS=\frac{X}{Y}, and XX and YY are coprime.

1 2
1
2

Hint

m>1m>1, n>0n>0.

50%50 \% of the testdata satisfy n50n \leq 50.
100%100 \% of the testdata satisfy n+m500n+m \leq 500.

Translated by ChatGPT 5