#include <bits/stdc++.h>
using namespace std;
#define ll long long

vector<int> sieve(int n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
     
    vector<int> ans;
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          ans.push_back(p);
          
    return ans;
} 

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int t,n,i,j,k;
	
	auto p = sieve(100001);
	
	cin>>t;
	while(t--)
	{
	    cin>>n;
	    ll x = *lower_bound(p.begin(),p.end(),1+n);
	    ll y = *lower_bound(p.begin(),p.end(),x+n);
	    cout<<x*y<<endl;
	}
	
	return 0;
}
