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