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