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.
#include <bits/stdc++.h>
const long long kot = LLONG_MAX;
using ld = long double;
const int MAXIT = 100;
const long long int alpha = 1e18;
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int powe(long long int x, unsigned long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool comp(long long int a, long long int b) { return (a < b); }
vector<long long int> ve;
void divisors(long long int n) {
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        ve.push_back(i);
      else
        ve.push_back(i);
      ve.push_back(n / i);
    }
  }
}
bool isPrime(long long int n) {
  if (n == 1) {
    return false;
  }
  long long int i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      return false;
    }
    i += 1;
  }
  return true;
}
long long int gcdofarray(vector<long long int> &v, long long int n) {
  long long int result = v[0];
  for (long long int i = 1; i < n; i++) result = gcd(v[i], result);
  return result;
}
long long int sumofdigits(long long int n) {
  long long int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
bool powertwo(long long int x) { return x && (!(x & (x - 1))); }
string removeDuplicatesFromString(string str) {
  long long int counter = 0;
  long long int i = 0;
  long long int size = str.size();
  long long int x;
  long long int length = 0;
  while (i < size) {
    x = str[i] - 97;
    if ((counter & (1 << x)) == 0) {
      str[length] = 'a' + x;
      counter = counter | (1 << x);
      length++;
    }
    i++;
  }
  return str.substr(0, length);
}
long long int commDiv(long long int a, long long int b) {
  long long int n = gcd(a, b);
  long long int result = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        result += 1;
      else
        result += 2;
    }
  }
  return result;
}
long long int fact(long long int n) {
  if (n <= 1) return 1;
  return n * fact(n - 1);
}
long long int nPr(long long int n, long long int r) {
  return fact(n) / fact(n - r);
}
long long int kash(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
long long int maxi(long long int a, long long int b) { return (a > b) ? a : b; }
long long int mini(long long int a, long long int b) { return (a < b) ? a : b; }
long long int nCr(long long int n, long long int r) {
  return fact(n) / (fact(r) * fact(n - r));
}
bool sortByVal(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
long long int check(long long int arr[], long long int n, long long int v) {
  long long int dp[v + 1];
  dp[0] = 0;
  long long int i, j;
  for (i = 1; i <= v; i++) {
    dp[i] = INT_MAX;
  }
  for (i = 1; i <= v; i++) {
    for (j = 0; j < n; j++) {
      if (arr[i] <= i) {
        long long int y = dp[i - arr[j]];
        if (y != INT_MAX && y + 1 < arr[i]) {
          dp[i] = y + 1;
        }
      }
    }
  }
  return dp[v];
}
long long int maxSubArraySum(long long int a[], long long int size) {
  long long int max_so_far = INT_MIN, max_ending_here = 0;
  for (long long int i = 0; i < size; i++) {
    max_ending_here = max_ending_here + a[i];
    if (max_so_far < max_ending_here) max_so_far = max_ending_here;
    if (max_ending_here < 0) max_ending_here = 0;
  }
  return max_so_far;
}
bool isvowel(char ch) {
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
    return true;
  }
  return false;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int parent[100001];
long long int find(long long int a) {
  while (parent[a] > 0) {
    a = parent[a];
  }
  return a;
}
void Union(long long int a, long long int b) {
  parent[a] += parent[b];
  parent[b] = a;
}
bool ispalind(string str) {
  string s = str;
  if (s == str) return true;
  return false;
}
long long int josephus(long long int n, long long int k) {
  if (n == 1) {
    return 1;
  } else {
    return (josephus(n - 1, k - 1) + k - 1) % (n) + 1;
  }
}
void solve() {
  long long int tt = 1;
  cin >> tt;
  for (long long int d1 = 0; d1 < tt; d1++) {
    long long int n;
    cin >> n;
    if (n == 1 || n == 2 || n == 3 || n == 5 || n == 7 || n == 11) {
      cout << -1 << "\n";
      continue;
    }
    long long int z = n / 4;
    if (n % 4 == 1)
      z--;
    else if (n % 4 == 3)
      z--;
    cout << z << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
}
