#include<stdio.h> int main() { int i,t,a,x; scanf("%d",&t); while(t>0){ t--; scanf("%d",&a); x=-1; if(a>14) x=a-7; printf("%d\n",x); } return 0; }