P21984 [HackerRank] Mathematical expectation
提高-
题目描述

Let's consider a random permutation p_{1}, p_{2}, ..., p_{N} of numbers 1, 2, ..., N and calculate the value F=(X_{2}+...+X_{N-1})^{K}, where X_{i} equals 1 if one of the following two conditions holds: p_{i-1} < p_{i} > p_{i+1} or p_{i-1} > p_{i} < p_{i+1} and X_{i} equals 0 otherwise. What is the expected value of F?

Input Format:

The first line contains two integers K and N.

Output Format:

Print the expected value of F as an irreducible fraction p / q. Follow sample input for more clarification.

Constraints:

1000 <= N <= 10^{9}

1 <= K <= 5

Sample input

1 1000

Sample Output

1996 / 3

输入格式

见题面

输出格式

见题面

样例输入
1 1000
样例输出
1996 / 3