using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var Q = int.Parse(ReadLine()); var n = new long[Q]; for (int i = 0; i < Q; i++) { n[i] = long.Parse(ReadLine()); } var T = new int[9824];//10e18 T[3] = 1; for (int j = 4; j < T.Length; j++) { T[j] = (T[j - 1] + T[j - 2] + T[j - 3] + T[j - 4]) % 17; } for (int i = 0; i < Q; i++) { WriteLine(T[(n[i] - 1) % 9824]); } } }