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 "bits/stdc++.h"
using namespace std;

long long GCD(long long A, long long B) {
	return (B == 0 ? A : GCD(B, A % B));
}

int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };

int main() {
	int N;
	cin >> N;
	int L = ((N + 1) / 2) * 2;
	vector<int> Primes;
	for (int i = 100; ; i++) {
		bool check = true;
		for (int j = 2; j * j <= i; j++) {
			if (i % j == 0) {
				check = false;
				break;
			}
		}
		if (check) Primes.push_back(i);
		if (Primes.size() == L) break;
	}
	vector<long long> X(N), Y(N);
	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			X[i] = Primes[i / 2];
			Y[i] = Primes[i / 2 + L / 2];
		}
		else {
			X[i] = X[i - 1] * 2;
			Y[i] = Y[i - 1] * 2;
		}
	}
	vector<vector<long long> > ANS(N, vector<long long>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if ((i & 1) == (j & 1)) ANS[i][j] = X[i] * Y[j];
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if ((i & 1) != (j & 1)) {
				ANS[i][j] = 1;
				for (int k = 0; k < 4; k++) {
					int ni = i + dx[k], nj = j + dy[k];
					if (0 <= ni && ni < N && 0 <= nj && nj < N) {
						ANS[i][j] *= ANS[ni][nj] / GCD(ANS[i][j], ANS[ni][nj]);
					}
				}
				if (i % 2 == 0) ANS[i][j] *= 2;
				ANS[i][j]++;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cout << ANS[i][j] << (j == N - 1 ? '\n' : ' ');
		}
	}
}