Positive integer x is called divisor of positive integer y, if y is divisible by x without remainder. For example, 1 is a divisor of 7 and 3 is not divisor of 8.

We gave you an integer d and asked you to find the smallest positive integer a, such that 

  * a has at least 4 divisors; 
  * difference between any two divisors of a is at least d.

Input

The first line contains a single integer t (1 ≤ t ≤ 3000) — the number of test cases.

The first line of each test case contains a single integer d (1 ≤ d ≤ 10000).

Output

For each test case print one integer a — the answer for this test case.

Example

Input


2
1
2


Output


6
15

Note

In the first test case, integer 6 have following divisors: [1, 2, 3, 6]. There are 4 of them and the difference between any two of them is at least 1. There is no smaller integer with at least 4 divisors.

In the second test case, integer 15 have following divisors: [1, 3, 5, 15]. There are 4 of them and the difference between any two of them is at least 2.

The answer 12 is INVALID because divisors are [1, 2, 3, 4, 6, 12]. And the difference between, for example, divisors 2 and 3 is less than d=2.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;

public class CodeForces {
	
	static class Track{
		
		int start;
		int end;
		
		public Track(int start, int end) {
			super();
			this.start = start;
			this.end = end;
		}

		@Override
		public String toString() {
			return "Track [start=" + start + ", end=" + end + "]";
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + end;
			result = prime * result + start;
			return result;
		}
		
		
		
		
	}

	static class Range {

		String s;

		public Range(String s) {
			this.s = s;
		}

		@Override
		public String toString() {
			return s;
		}
	}

	static class RangeComparator implements Comparator<Range> {

		public int compare(Range o1, Range o2) {
			String[] v1 = o1.s.split("#");
			String[] v2 = o2.s.split("#");
			int val1 = Integer.parseInt(v1[1]) - Integer.parseInt(v1[0]);
			int val2 = Integer.parseInt(v2[1]) - Integer.parseInt(v2[0]);
			if (val1 > val2) {
				return -1;
			} else if (val2 > val1) {
				return 1;
			}
			return o1.s.compareTo(o2.s);
		}

	}

	public static void printArray(int[] arr) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
	}

	public static int[] getIntArray(BufferedReader br) throws IOException {
		String line = br.readLine();
		String[] values = line.split(" ");
		int[] arr = new int[values.length];
		for (int i = 0; i < values.length; i++) {
			arr[i] = Integer.parseInt(values[i]);
		}
		return arr;
	}

	public static long[] getLongArray(BufferedReader br) throws IOException {
		String line = br.readLine();
		String[] values = line.split(" ");
		long[] arr = new long[values.length];
		for (int i = 0; i < values.length; i++) {
			arr[i] = Long.parseLong(values[i]);
		}
		return arr;
	}
	
	public static List<Long> getLongList(BufferedReader br) throws IOException {
		String line = br.readLine();
		String[] values = line.split(" ");
		List<Long> list = new ArrayList<>();
		for (int i = 0; i < values.length; i++) {
			list.add(Long.parseLong(values[i]));
		}
		return list;
	}
	
	public static String[] getStringArray(BufferedReader br) throws IOException {
		String line = br.readLine();
		String[] values = line.split(" ");
		return values;
	}

	public static Set<Integer> getFactors(int n) {
		Set<Integer> set = new HashSet<>();
		for (int i = 2; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				set.add(i);
				set.add(n / i);
			}
		}
		return set;
	}

	public static int[] decode(String s) {
		String[] v = s.split("#");
		int[] arr = new int[2];
		arr[0] = Integer.parseInt(v[0]);
		arr[1] = Integer.parseInt(v[1]);
		return arr;
	}

	public static String encode(int a, int b) {
		return a + "#" + b;
	}

	public static long lcm(long a, long b) {
		BigInteger bigGCD = BigInteger.valueOf(a).gcd(BigInteger.valueOf(b));
		long val = bigGCD.longValue();
		long prod = a * b;
		return prod / val;
	}

	public static Set<Integer> getPrimes() {
		Set<Integer> primes = new HashSet<>();
		for (int i = 2; i < 20000; i++) {
			int fac = 0;
			for (int j = 1; j <= Math.sqrt(i); j++) {
				if (i % j == 0) {
					fac += 2;
				}
			}

			if (fac == 2) {
				primes.add(i);
			}
		}

//		System.out.println(primes.size());

		return primes;
	}
	
	public static List<Integer> getPrimeList() {
		List<Integer> primes = new ArrayList<>();
		for (int i = 2; i < 25000; i++) {
			int fac = 0;
			for (int j = 1; j <= Math.sqrt(i); j++) {
				if (i % j == 0) {
					fac += 2;
				}
			}

			if (fac == 2) {
				primes.add(i);
			}
		}

//		System.out.println(primes.size());

		return primes;
	}
	
	public static long process(long n){
		if(n%2==0){
			return n/2;
		}
		
		long min = n;
		
		for(long i=2;i<=(long)Math.sqrt(n);i++){
			if(n%i==0){
				min =  Math.min(min, i);
				min =  Math.min(min, n/i);
			}
		}
		
		return 1+ process(n-min);
		
	}
	
	public static int sum(String a){
		int sum=0;
		for(int i=0;i<a.length();i++){
			sum+=a.charAt(i)-48;
		}
		return sum;
	}
	
	public static boolean check(long[] arr){
		long pre =-1;
		for(long val: arr){
			if(val!=Long.MAX_VALUE){
				if(pre==-1){
					pre = val;
				}else{
					if(val!=pre){
						return false;
					}
				}
			}
		}
		return true;
	}
	
	public static int getLeftIdx(long[] arr,int v){
		int idx=-1;
		for(int i=v-1;i>=0;i--){
			if(arr[i]!=Long.MAX_VALUE){
				idx =i;
				break;
			}
		}
		return idx;
	}
	
	public static int getRightIdx(long[] arr,int v){
		int idx=-1;
		for(int i=v+1;i<arr.length;i++){
			if(arr[i]!=Long.MAX_VALUE){
				idx =i;
				break;
			}
		}
		return idx;
	}
	
	
	public static String pEncode(int x,int y ,char D,int c){
		return x + "#" + y+"#"+D+"#"+c;
	}
	
	public static boolean proc(Long val){
		String s = val.toString(); 
		boolean ans = true;
		for(int i=0;i<s.length();i++){
			int v = s.charAt(i)-48;
//			System.out.println(v);
			if(v!=0 && val%v!=0 ){
				ans = false;
				break;
			}
		}
		return ans;
	}
	
	

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int t = Integer.parseInt(line);
//		System.out.println(values);
		
//		int t = 1;
		
		List<Integer> primes = getPrimeList();
//		System.out.println(primes);
		
		while (t-- > 0) {
//			 line = br.readLine();
//			long[] arr = getLongArray(br);
			line = br.readLine();
			int value = Integer.parseInt(line);
//			String ip = br.readLine();
			
			
			int one = 1+value;
			
			int v1 = Collections.binarySearch(primes, one);
			
//			System.out.println(v1);
			
			
			if(v1<0){
				one =  primes.get(Math.abs(v1)-1);
			}else{
				one =  primes.get(Math.abs(v1));
			}
			
//			System.out.println(one);
			
			int two = one+value;
			
			int v2 = Collections.binarySearch(primes, two);
			
			if(v2<0){
				two =  primes.get(Math.abs(v2)-1);
			}else{
				two =  primes.get(Math.abs(v2));
			}
			
			long ans = one*two;
			
			System.out.println(ans);
			
		}
		
		

	}
	

}




