FirstHack Learn
Log in Sign up free
← All problems

Factorial of N

Easy 4 solved

Factorial of N

The factorial of N, written N!, is the product of every integer from 1 to N. For example 4! = 4 3 2 * 1 = 24.

By definition 0! is 1.

Given N, print N!. The answer grows very fast, so in C, C++ or Java use a 64-bit type (long long / long). Python handles big integers on its own.

Input

A single line containing one integer N.

Output

A single integer: the value of N!.

Constraints

0 <= N <= 20

Example 1
Input
5
Output
120

5 * 4 * 3 * 2 * 1 = 120

Submit runs your code against 5 test cases — the 1 shown above plus 4 hidden ones covering the awkward cases. Run sample just tries the first example, which is usually what you want while you are still working it out.