9400 - Factorials   

Description

Calculate N! = 1×2×...×(N-1)×N. Note the number may exceed the range of integer or long long data type. Need to define a data structure to store the computed results. Note that 0! is defined as 1.

Input

There are multiple test cases. The first line contains an integer t, which indicates the number of test cases. Each test case is in a line, containing a number N (0<= N <= 114).

Output

For each case, output N!

9400 : N! < 2^31-1, 0 < t <= 15 
9401 : N! < 2^63-1, 0 < t <= 25

9402 : N! < 10^200, 0 < t <= 150 
9403 : N! < 10^200, 0 < t <=10^5 (Since t >> N, N! should be counted only one time and save it. Otherwise, you might got TLE!)

Sample Input  Download

Sample Output  Download

Tags




Discuss