#K93562. Factorial Fibonacci

    ID: 38447 Type: Default 1000ms 256MiB

Factorial Fibonacci

Factorial Fibonacci

Given an integer N, calculate the Nth term of the Factorial Fibonacci sequence. The sequence is defined as follows:

\(a_1 = 1, \quad a_2 = 1\)

For \(n \geq 3\), \(a_n = a_{n-1} + (n-2)!\), where \((n-2)!\) represents the factorial of \((n-2)\).

For example, the first few terms of the sequence are: 1, 1, 2, 4, 10, 34, ...

You will be given multiple test cases. The first line of input contains an integer T, representing the number of test cases. Each of the following T lines contains a single integer N. For each test case, compute the corresponding Factorial Fibonacci value and print it on a new line.

inputFormat

The input consists of multiple lines. The first line contains the integer T, the number of test cases. Each of the following T lines contains a single integer N.

outputFormat

For each test case, output the Factorial Fibonacci value corresponding to N on a separate line.## sample

3
1
3
5
1

2 10

</p>