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