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 sys,math,io,os,time,itertools,collections
mod=10**9+7
sys.setrecursionlimit(10000)
i=sys.stdin.readline
p=sys.stdout.write
#use sys.stdout.write() (remember to convert to str b4 and concatenate "\n")
global start,end

#binary search
def isin(l,x):
    left=0
    right=len(l)-1
    if x<l[0]:
        return -1
    while left<=right:
        mid=left + (right -left)//2
        if l[mid]==x:
            return mid
        elif l[mid]<x:
            ans=mid
            left=mid+1
        else:
            right=mid-1
    return ans

#is palindrome or not
def ispal(l):
    n=len(l)
    for i in range(n//2+1):
        if l[i]!=l[n-i-1]:
            return False
    return True

#coordinate compression
def ccarray(l):
    d={l[k]:k for k in range(len(l))}
    m=sorted(d)
    return [d[m[k]] for k in range(len(l))]

#checks if prime or not
def is_prime(n):
    if n<=3:
        return n>1
    if n%2==0 or n%3==0:
        return False
    k=5
    while k**2<=n:
        if n%k==0 or n%(k+2)==0:
            return False
        k+=6
    return True

#sieve of eratosthenes
def sieve(n):
    prime=[True for k in range(n+1)]
    p=2
    while p*p<=n:
        if prime[p]==True:
            for k in range(p*p,n+1,p):
                prime[k]=False
        p+=1

def main():
    n=int(i())
    if n%4==0:
        p(str(n//4)+"\n")
    elif n%4==1:
        if n<9:
            p("-1\n")
        else:
            p(str(1+(n-9)//4)+"\n")
    elif n%4==2:
        if n<6:
            p("-1\n")
        else:
            p(str(1+(n-6)//4)+"\n")
    else:
        if n<15:
            p("-1\n")
        else:
            p(str(2+(n-15)//4)+"\n")

t=1
t=int(i())
start=time.perf_counter()
for _ in range(t):
    main()
end=time.perf_counter()
#print(end-start)