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