9144 - Factorials   

Description

Calculate N! = 1 × 2 × ... × (N - 1) × N. Note that the number may exceed the range of primitive integer type. A data structure should be maintained to store the computed results.

Input

There are multiple test cases in each data set. Each test case contains a single integer denoting N (1 ≤ N ≤ 500) in a line. The input is terminated by end-of-file.

Output

For each given N, output the value of N! in a line.

Technical Specification

For data set #1, 1 ≤ N ≤ 20.

For data set #2, 1 ≤ N ≤ 50.

For data set #3, 1 ≤ N ≤ 200.

For data set #4, 1 ≤ N ≤ 500.

Sample Input  Download

Sample Output  Download

Tags




Discuss