import sys

n = int(sys.stdin.readline())


dp = [[0]*4 for _ in range(10001)]

dp[1][1] = dp[2][1] = dp[2][2] = dp[3][1] = dp[3][2] = dp[3][3] = 1



for i in range(4, 10001):
    dp[i][1] = 1
    dp[i][2] = dp[i-2][1] + dp[i-2][2]
    dp[i][3] = dp[i-3][1] + dp[i-3][2] + dp[i-3][3]



while n:

    num = int(sys.stdin.readline())
    print(dp[num][1] + dp[num][2] + dp[num][3])


    n -=1
81a1e9080908c91c8aa8cd72a360b1b514742781
<mask token>

<mask token>
for i in range(4, 10001):
    dp[i][1] = 1
    dp[i][2] = dp[i - 2][1] + dp[i - 2][2]
    dp[i][3] = dp[i - 3][1] + dp[i - 3][2] + dp[i - 3][3]
while n:
    num = int(sys.stdin.readline())
    print(dp[num][1] + dp[num][2] + dp[num][3])
    n -= 1

<mask token>
n = int(sys.stdin.readline())
dp = [([0] * 4) for _ in range(10001)]
dp[1][1] = dp[2][1] = dp[2][2] = dp[3][1] = dp[3][2] = dp[3][3] = 1
for i in range(4, 10001):
    dp[i][1] = 1
    dp[i][2] = dp[i - 2][1] + dp[i - 2][2]
    dp[i][3] = dp[i - 3][1] + dp[i - 3][2] + dp[i - 3][3]
while n:
    num = int(sys.stdin.readline())
    print(dp[num][1] + dp[num][2] + dp[num][3])
    n -= 1

import sys
n = int(sys.stdin.readline())
dp = [([0] * 4) for _ in range(10001)]
dp[1][1] = dp[2][1] = dp[2][2] = dp[3][1] = dp[3][2] = dp[3][3] = 1
for i in range(4, 10001):
    dp[i][1] = 1
    dp[i][2] = dp[i - 2][1] + dp[i - 2][2]
    dp[i][3] = dp[i - 3][1] + dp[i - 3][2] + dp[i - 3][3]
while n:
    num = int(sys.stdin.readline())
    print(dp[num][1] + dp[num][2] + dp[num][3])
    n -= 1

import sys

n = int(sys.stdin.readline())


dp = [[0]*4 for _ in range(10001)]

dp[1][1] = dp[2][1] = dp[2][2] = dp[3][1] = dp[3][2] = dp[3][3] = 1



for i in range(4, 10001):
    dp[i][1] = 1
    dp[i][2] = dp[i-2][1] + dp[i-2][2]
    dp[i][3] = dp[i-3][1] + dp[i-3][2] + dp[i-3][3]



while n:

    num = int(sys.stdin.readline())
    print(dp[num][1] + dp[num][2] + dp[num][3])


    n -=1