// Arup Guha
// 9/7/2013
// Solution to UCF JV Practice Problem J: Sum

import java.util.*;

public class j {

	final public static int MAX = 100;

	public static void main(String[] args) {

		// Pre-compute answers, very similar to tile problem. Recurrence is
		// f(n) = f(n-2) + f(n-3) + f(n-5)
		long[] ans = new long[MAX+1];
		ans[0] = 1;
		ans[1] = 0;
		ans[2] = 1;
		ans[3] = 1;
		ans[4] = 1;
		//ans[5] = 3;

		for (int i=5; i<=MAX; i++)
			ans[i] = (ans[i-2] + ans[i-3] + ans[i-5]);

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Just answer every case.
		for (int loop=0; loop<numCases; loop++) {
			int n = stdin.nextInt();
			System.out.println(ans[n]);
		}
	}
}