#K33482. Fibonacci Flower Heights

    ID: 25097 Type: Default 1000ms 256MiB

Fibonacci Flower Heights

Fibonacci Flower Heights

In this problem, you are given a series of test cases representing the number of flowers. Each flower grows following the Fibonacci sequence pattern. Specifically, the height of the first flower is 11, the second is also 11, and for n3n \ge 3, the nn-th flower's height is defined as:

F(n)=F(n1)+F(n2)F(n)=F(n-1)+F(n-2)

Your task is to calculate the combined height of the first NN flowers, which is the sum:

S(N)=i=1NF(i)S(N)=\sum_{i=1}^{N} F(i)

For example:

  • If $N = 1$, then the height is $1$.
  • If $N = 3$, then the heights are $1, 1, 2$ and the combined height is $4$.
  • If $N = 5$, then the heights are $1, 1, 2, 3, 5$ and the combined height is $12$.

Make sure your solution reads inputs from standard input and outputs the result for each test case to standard output.

inputFormat

The input begins with an integer TT, representing the number of test cases. Then TT lines follow; each line contains a single positive integer NN, the number of flowers.

outputFormat

For each test case, output a single integer representing the combined height (i.e. the sum of the first NN Fibonacci numbers) on a new line.## sample

3
1
3
5
1

4 12

</p>