using System; using System.Linq; using System.Collections.Generic; namespace y { class Program { static void Main(string[] args) { var q = int.Parse(Console.ReadLine()); int a = (int)Math.Pow(10, 6); int[] u = new int[a]; u[0] = 0; u[1] = 0; u[2] = 0; u[3] = 1; for (int i = 4; i < a; i++) { u[i] = (u[i - 1] + u[i - 2] + u[i - 3] + u[i - 4]) % 17; } int[] ans = new int[q]; for (int i = 0; i < q; i++) { var n = int.Parse(Console.ReadLine()); ans[i] = u[n - 1]; } foreach (var item in ans) { Console.WriteLine(item); } } } }