Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-qosh-faktorial

Double factorial (n!!)

Easy 1000 ms 64 MB 23%
Share

A positive integer $n$ is given. Compute its double factorial $n!!$:

$$n!! = n * (n - 2) * (n - 4) * \dots$$

The last factor is $1$ if $n$ is odd and $2$ if $n$ is even.

A chain of factors decreasing by two each time

Input

One integer $n$.

Output

One integer — $n!!$.

Note

$1 \le n \le 25$

Examples

Input #1
5
Output #1
15
Input #2
6
Output #2
48

Sign in to submit a solution

Signing up is free and takes a minute.