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