ZCC Loves Intersection

Time Limit: 2000/1000 MS (Java/Others)

Memory Limit: 131072/131072 K (Java/Others)

Description

After beats all opponents in 3-dimension-world OI, ZCC feels bored and sets about going to other universes. In a universe with D dimension(s), ZCC finds D segments floating in the air. To be more precise: if we build a rectangular coordinate system with D axis, each of the segments is parallel with one axis, whose endpoints have a coordination of which all components belong to the set {x∈Z|0≤x<N}. For each axis, there is exactly one segment parallel with it.
Each of the D segments changes location every second. Read the pseudo code below for more details:

Every second, from every pair of segments intersect, ZCC acquires a unit of Energy. Calculate the Expectation of the amount of the acquired energy per second please.

Input

There are several test cases in one input file. EOF indicates the end of input file.
Every test case contain two positive numbers N, D in one line.
It is guaranteed that 1<N≤10^9, D≤99. The number of test cases≤10.

Output

For each test case, output a line with an integer or an irreducible fraction p/q, which is the Expectation.

Sample Input

2 2 3 3 5 5

Sample Output

1 49/81 18/625
Hint
For the first test case of the sample input, there are 2 segments in a 2*2 lattice. Because two endpoint couldn’t coincide, two segments must be (0,y)-(1,y) and (x,0)-(x,1). (x, y∈{0,1}) Thus, they always intersect at (x,y). As an irreducible fraction the answer is 1/1, where q = 1, so we should output an integer 1 instead.

Hint

Source

2014 Multi-University Training Contest 2

提交代码