You are given a matrix aa consisting of positive integers. It has nn rows and mm columns.

Construct aa matrix bb consisting of positive integers. It should have the same size as aa, and the following conditions should be met:

  • 1bi,j1061≤b_{i,j}≤10^6;
  • bi,jb_{i,j} is a multiple of ai,ja_{i,j};
  • the absolute value of the difference between numbers in any adjacent pair of cells (two cells that share the same side) in - bb is equal to k4k^4 for some integer k1k≥1 (kk is not necessarily the same for all pairs, it is own for each pair).
    We can show that the answer always exists.

Input

The first line contains two integers nn and mm (2n,m5002≤n,m≤500).

Each of the following nn lines contains mm integers. The jj-th integer in the ii-th line is ai,ja_{i,j} (1ai,j161≤a_{i,j}≤16).

Output

The output should contain nn lines each containing mm integers. The jj-th integer in the ii-th line should be bi,jb_{i,j}.

Examples

input

1
2
3
2 2
1 2
2 3

output

1
2
1 2
2 3

input

1
2
3
2 3
16 16 16
16 16 16

output

1
2
16 32 48
32 48 64

input

1
2
3
2 2
3 11
12 8

output

1
2
327 583
408 664

Note

In the first example, the matrix aa can be used as the matrix bb, because the absolute value of the difference between numbers in any adjacent pair of cells is 1=141=1^4.

In the third example:

327327 is a multiple of 33, 583583 is a multiple of 1111, 408408 is a multiple of 1212, 664664 is a multiple of 88;
408327=34|408−327|=3^4, 583327=44|583−327|=4^4, 664408=44|664−408|=4^4, 664583=34|664−583|=3^4.

Idea

1ai,j161\le a_{i,j}\le 16,而 1161\sim 16 的最小公倍数只有 lcm=720720\mathrm{lcm}=720720,这就给了启发。

i+ji+j 为偶数的位置填 lcm\mathrm{lcm},否则填 lcm+ai,j4\mathrm{lcm}+a_{i,j}^4,即符合题意。

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/******************************************************************
Copyright: 11D_Beyonder All Rights Reserved
Author: 11D_Beyonder
Problem ID: CF1458D
Date: 2021 Mar. 3rd
Description: Number Theory, Construction
*******************************************************************/
#include<iostream>
using namespace std;
int main(){
int n,m;
const int lcm=720720;
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int a;
cin>>a;
cout<<(((i+j)&1)?lcm+a*a*a*a:lcm)<<(j==m?'\n':' ');
}
}
return 0;
}