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