Problem: You are given an integer N.

Construct any one N-by-N matrix a that satisfies the conditions below. It can be proved that a solution always exists under the constraints of this problem.

* 1 \leq a_{i,j} \leq 10^{15}
* a_{i,j} are pairwise distinct integers.
* There exists a positive integer m such that the following holds: Let x and y be two elements of the matrix that are vertically or horizontally adjacent. Then, {\rm max}(x,y) {\rm mod} {\rm min}(x,y) is always m.

Constraints

* 2 \leq N \leq 500

Input

Input is given from Standard Input in the following format:


N


Output

Print your solution in the following format:


a_{1,1} ... a_{1,N}
:
a_{N,1} ... a_{N,N}

Output

Print your solution in the following format:


a_{1,1} ... a_{1,N}
:
a_{N,1} ... a_{N,N}

Example

Input

2


Output

4 7
23 10

Solution (in CPP):

Solution:
#include <stdio.h>
#include <vector>
#include <bitset>
using namespace std;
const int N=5e2+10;
const int C=1e4+10;
const int SC=1e2+10;
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a>b?b:a;}
long long int gcd(long long int a,long long int b){return b==0?a:gcd(b,a%b);}
long long int lcm(long long int a,long long int b){return a/gcd(a,b)*b;}
long long int ans[N][N];
int n;
long long int f(int a,int b){
if(a<0||b<0||a>=n||b>=n)return 1;
else return ans[a][b];
}
int main(){
int tot;
bitset<C> went;
vector<int> prime;
scanf("%d",&n);
if(n==2){
printf("4 7\n23 10\n");
return 0;
}
went.reset();
prime.push_back(2);
for(int i=3;i<SC;i+=2){
if(!went[i]){
prime.push_back(i);
for(int j=i*i;j<C;j+=i<<1)went[j]=true;
}
}
for(int i=SC+1;i<C;i+=2)if(!went[i])prime.push_back(i);
for(int i=0;i<n;i++)for(int j=0;j<n;j++)ans[i][j]=0;
for(int i=0;i<n;i++){
tot=min(i,n-i-1);
for(int j=-tot;j<=tot;j++)ans[i+j][i-j]=prime[i];
}
for(int i=-((n-1)>>1);i<((n+1)>>1);i++){
tot=min(n-i-1,n+i-1);
for(int j=max(i,-i);j<=tot;j++)ans[i+j][j-i]*=prime[i+n+((n-1)>>1)];
}
for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(ans[i][j]==0)ans[i][j]=lcm(lcm(f(i-1,j),f(i,j-1)),lcm(f(i+1,j),f(i,j+1)))+1;
for(int i=0;i<n;i++){
printf("%lld",ans[i][0]);
for(int j=1;j<n;j++)printf(" %lld",ans[i][j]);
printf("\n");
}
}