package net.ipipip0129.yukicoder.no657; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int count = Integer.parseInt(br.readLine()); int maxSize = 4; List tet = new ArrayList<>(); tet.add(0); tet.add(0); tet.add(0); tet.add(1); for (int c = 0; c < count; c++) { int n = Integer.parseInt(br.readLine()); if (maxSize < n) { for (int i = maxSize; i < n; i++) { tet.add((tet.get(i - 1) + tet.get(i - 2) + tet.get(i - 3) + tet.get(i - 4)) % 17); } maxSize = n; } out.println(tet.get(n - 1)); } out.flush(); out.close(); br.close(); } }