#C7832. Factorial Calculation

    ID: 51747 Type: Default 1000ms 256MiB

Factorial Calculation

Factorial Calculation

Given a single integer ( n ), compute the factorial defined as ( n! = 1 \times 2 \times 3 \times \cdots \times n ) for ( n > 0 ) with the special case ( 0! = 1 ). For any negative ( n ), output (-1) to indicate an error. Your program must read the input from standard input and write the result to standard output.

inputFormat

The input consists of a single integer ( n ) provided via standard input on one line.

outputFormat

Output a single integer which is ( n! ) if ( n ) is non-negative, otherwise output (-1).## sample

5
120