You are given several queries. In the i-th query you are given a single positive integer ni. You are to represent ni as a sum of maximum possible number of composite summands and print this maximum number, or print -1, if there are no such splittings.

An integer greater than 1 is composite, if it is not prime, i.e. if it has positive divisors not equal to 1 and the integer itself.

Input

The first line contains single integer q (1 ≤ q ≤ 105) — the number of queries.

q lines follow. The (i + 1)-th line contains single integer ni (1 ≤ ni ≤ 109) — the i-th query.

Output

For each query print the maximum possible number of summands in a valid splitting to composite summands, or -1, if there are no such splittings.

Examples

Input

1
12


Output

3


Input

2
6
8


Output

1
2


Input

3
1
2
3


Output

-1
-1
-1

Note

12 = 4 + 4 + 4 = 4 + 8 = 6 + 6 = 12, but the first splitting has the maximum possible number of summands.

8 = 4 + 4, 6 can't be split into several composite summands.

1, 2, 3 are less than any composite number, so they do not have valid splittings.


import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
  
public class er10a
{ 
    //By shwetank_verma
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
    static int mod=1000000007;
    static boolean primes[]=new boolean[1000007];
    static ArrayList<Integer> b=new ArrayList<>();
    static void seive(int n){
        Arrays.fill(primes,true);
        primes[0]=primes[1]=false;
        for(int i=2;i*i<=n;i++){
            if(primes[i]==true){
                for(int p=i*i;p<=n;p+=i){
                    primes[p]=false;
                }
            }
        }
        if(n<1000007){
        	for(int i=2;i<=n;i++) {
        		if(primes[i])
        			b.add(i);
        	}
        	
                 }
        
        
    }
    static int gcd(int a,int b){
        if(b==0)
        return a;
        return gcd(b,a%b);
    }
    static long GCD(long a,long b){
        if(b==0)
        return a;
        return GCD(b,a%b);
    }
    static ArrayList<Integer> segseive(int l,int r){
    	
    	ArrayList<Integer> isprime=new ArrayList<Integer>();
    	boolean p[]=new boolean[r-l+1];
    	Arrays.fill(p, true);
        
    	for(int i=0;b.get(i)*b.get(i)<=r;i++) {
    		int currprime=b.get(i);
    		int base=(l/currprime)*currprime;
    		if(base<l) {
    			base+=currprime;
    		}
    		for(int j=base;j<=r;j+=currprime) {
    			p[j-l]=false;
    		}
    		
    		
    		if(base==currprime) {
    			p[base-l]=true;
    		}
    		
    	}
    	for(int i=0;i<=r-l;i++) {
    		if(p[i])
    			isprime.add(i+l);
    	}
    	return isprime;
    }
      static int LowerBound(int a[], int x) { // x is the target value or key
  int l=-1,r=a.length;
  while(l+1<r) {
    int m=(l+r)>>>1;
    if(a[m]>=x) r=m;
    else l=m;
  }
  return r;
}
static int UpperBound(int a[], int x) {// x is the key or target value
    int l=-1,r=a.length;
    while(l+1<r) {
       int m=(l+r)>>>1;
       if(a[m]<=x) l=m;
       else r=m;
    }
    return l+1;
 }
 static void addEdge(ArrayList<ArrayList<Integer>> adj,int u,int v) {
	 adj.get(u).add(v);
	 adj.get(v).add(u);
 }
 static void BFS(ArrayList<ArrayList<Integer>> adj,int s,boolean visited[]) {
	 Queue<Integer> q=new LinkedList<>();
	 q.add(s);
	 visited[s]=true;
	 while(!q.isEmpty()) {
		 int u=q.poll();
		 for(int v:adj.get(u)) {
			 if(!visited[v]) {
				 visited[v]=!visited[v];
				 q.add(v);
			 }
		 }
	 }
 }
 static int BFSconnectedcount(ArrayList<ArrayList<Integer>> adj,int v) {
	 boolean visited[]=new boolean[v+1];
	 int count=0;
	 for(int i=0;i<v;i++) {
		 if(!visited[i]) {
			 BFS(adj,i,visited);
			 count++;
		 }
	 }
	 return count;
 }
 public static long power(long x, long y, long p) {
     long res = 1;
     x = x % p;
     while (y>0) {
        if ((y&1)==1) {
           res = (res*x) % p;
        }
        y = y >> 1;
        x = ( x * x ) % p;
     }
     return res;
  }
 public static long monInverse( long n, long p) {
     return power(n, p-2, p);
  }
  public static long nCrModPFermat( int n, int r, int p) {
     long[] fac = new long[n+1];
     fac[0] = 1;
     for (int i = 0; i < n; i++) {
        fac[i+1] = (fac[i]*(i+1))%p;
     }
long x = monInverse(fac[r], p);
long y = monInverse(fac[n-r], p);
//System.out.println(fac[n]);
     return (((fac[n]*x)% p) * ( y%p) ) % p;
  }
 static class Point
  {
      int x, y;
      Point(int x, int y)
      {
          this.x = x;
          this.y = y;
      }
  }

  // This class implements 
  // Comparator interface
  static class MyCmp implements Comparator<Point>
  {
      // Sorts the Point objects according
      // to x-coordinates in natural order
      public int compare(Point p1, Point p2)
      {
          return p1.x - p2.x;
      }
  }

    public static void main(String[] args) 
    { 
        FastReader sc=new FastReader(); 
        int t=sc.nextInt();
        
       
        while(t-->0) {
       long n=sc.nextInt();
       if(n==1 || n==2 || n==3 || n==5 || n==7 || n==11) {
           System.out.println(-1);
       }
       else if(n%2==1) {
           n-=9;
           System.out.println((n/4)+1);
       }
       else {
           System.out.println(n/4);
       }
      
        }
        
        
    } 
    
}
