#K56347. Fibonacci Sum
Fibonacci Sum
Fibonacci Sum
You are given an integer n. Your task is to compute the sum of the first n Fibonacci numbers. The Fibonacci sequence is defined as follows:
\(F_0 = 0, F_1 = 1\) and for \(i \geq 2\), \(F_i = F_{i-1} + F_{i-2}\).
Thus, the answer is \(S = \sum_{i=0}^{n-1} F_i\). Note that when n = 0, the sum is defined to be 0.
The input begins with an integer specifying the number of test cases, and then each test case consists of an integer n. For each test case, output the computed Fibonacci sum on a separate line.
inputFormat
The first line contains an integer T (the number of test cases). Each of the following T lines contains an integer n representing a test case.
Constraints: \(0 \leq n \leq 10^4\) (if needed, but for this problem, typical small values are expected).
outputFormat
For each test case, output a single line containing the sum of the first n Fibonacci numbers.
## sample7
0
1
2
3
4
5
10
0
0
1
2
4
7
88
</p>