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