A Times B II

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Authors:
Problem type

Solve the following problem for T test cases:

Given 2 numbers, A and B, can you calculate A! \times B! mod 10^9+7?

Constraints

1 \le T \le 10^5

1 \le A, B \le 10^5

Subtask 1 [50%]

T = 1

Subtask 2 [50%]

No additional constraints.

Input Specification

The first line of input will contain T.

The next T lines of input contain two space-separated integers A and B.

Output Specification

For each test case, output A! \times B! mod 10^9+7.

Sample Input

2
2 5
11 9

Sample Output

240
8282605

Comments

There are no comments at the moment.