Time

12:27:12
23 May 2012
Version for print

Binomial coefficients 2

You are given non-negative integers n and k. Find the factorization of the number C(n,k).


Specifications

   Input

   The first line contains the number of test cases t (t 10). Each of the following t lines describes one test case and contains the numbers n and k (0 n 100000, 0 k n), separated by space.

   Output

   Print t lines, each one should contain the factorization of the number C(n,k) for the corresponding test case.

   Prime factorization of the positive integer N should be written in the following way. If N = 1 you should output "1" (without quotes). Else let N = p1a1 * ... * pdad where p1, ..., pd are all different prime factors of the number N sorted in increasing order and a1, ..., ad are positive integers (ai is equal to the maximal degree of power of pi which divides N). Then you should output the line in the form

p1[^a1] * p2[^a2] * ... * pd[^ad]

Here [^ai] means that you should not output ^ai if ai = 1.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 2
Complexity: 40% 15/25
Autor: Anton Lunyov

Example

Example input

3
1 1
4 2
6 3

Example output

1
2 * 3
2^2 * 5


← Binomial coefficients 1 Problems Binomial coefficients 3 →