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