#C12812. Factorial Calculation

    ID: 42281 Type: Default 1000ms 256MiB

Factorial Calculation

Factorial Calculation

Given an integer \(n\), calculate its factorial defined by the formula \(n! = n \times (n-1) \times \cdots \times 1\) for \(n \geq 1\) with the special cases \(0! = 1\) and for negative values output "Invalid input". This problem is designed for beginners and tests your understanding of recursion and basic arithmetic operations.

inputFormat

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

outputFormat

Output the factorial of \(n\) if \(n \geq 0\). If \(n\) is negative, output "Invalid input".

## sample
5
120