Under construction

Still being built. Things may change

Padovan Sequence

Interview

Time limit1sMemory limit128 MB

Summary
For each test case, compute the Nth Padovan number defined by the spiral of equilateral triangles.
Level

Easy3 of 10

Topics
Dynamic programming, Array
Solved
No attempts yet

Problem

Equilateral triangles are attached one after another in a spiral. The first triangle has side length 1. After that, let kk be the length of the longest side of the spiral, and attach an equilateral triangle of side length kk to that side. This step repeats.

The Padovan sequence P(N)P(N) is the side length of the NN-th triangle placed in the spiral. The first ten values, P(1)P(1) through P(10)P(10), are 1, 1, 1, 2, 2, 3, 4, 5, 7, 9.

Given NN, write a program that computes P(N)P(N).

Input

The first line contains the number of test cases TT. Each test case is one line containing an integer NN. (1≤N≤1001 \le N \le 100)

Output

For each test case, print P(N)P(N) on its own line.

Examples1

  1. Example 1

    Input
    2
    6
    12
    
    Expected output
    3
    16