Page not loading? Try clicking here.
Placeholder

#1309

Factorial 1s 32MB

Problems

The factorial of a positive integer n is the product of all integers from 1 to n, denoted by n!.

It is defined as:

  • 0! = 1

  • 1! = 1

  • 2! = 2

  • n! = n × (n-1)!

For example, 4! = 4 × 3 × 2 × 1 = 24.

Write a program that, given n, prints the calculation process for n! and its result.

Note:

  • If the result exceeds the range of int, use long long data type.

  • Use %lld for input/output formatting in C/C++.


Input

A single line containing an integer n (1 ≤ n ≤ 15).


Output

Print the factorial calculation process as shown in the example, ending with the result.


Example

4
4! = 4 * 3!

3! = 3 * 2!
2! = 2 * 1!
1! = 1
24


Source

JUNGOL

You must sign in to write code.