#K38047. Compute Factorial

    ID: 26111 Type: Default 1000ms 256MiB

Compute Factorial

Compute Factorial

Given a non-negative integer \( n \), calculate its factorial.

The factorial of \( n \) is denoted as \( n! \) and defined as follows:

  • \( 0! = 1 \)
  • For \( n \ge 1,\; n! = n \times (n-1) \times \cdots \times 1 \)

If \( n \) is negative, the program should output "Error".

inputFormat

The input consists of a single integer \( n \) provided through standard input.

outputFormat

Output the factorial of \( n \) if \( n \) is non-negative. Otherwise, output "Error".

## sample
0
1