#include<stdio.h> void main() { int T; scanf("%d",&T); while(T--) { int A; scanf("%d",&A); if(A<=14) printf("-1\n"); else printf("%d\n",A-7); } }