import sys
tc = int(input())
lst = [0, 1, 1, 1, 2, 2]
for _ in range(tc):
N = int(input())
if N >= len(lst):
for i in range(len(lst), N+1):
lst.append(lst[i-1] + lst[i-5])
print(lst[N])
else:
print(lst[N])