Problem: You are given a matrix a consisting of positive integers. It has n rows and m columns.

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

  * 1 ≤ b_{i,j} ≤ 10^6; 
  * b_{i,j} is a multiple of a_{i,j}; 
  * the absolute value of the difference between numbers in any adjacent pair of cells (two cells that share the same side) in b is equal to k^4 for some integer k ≥ 1 (k 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 n and m (2 ≤ n,m ≤ 500).

Each of the following n lines contains m integers. The j-th integer in the i-th line is a_{i,j} (1 ≤ a_{i,j} ≤ 16).

Output

The output should contain n lines each containing m integers. The j-th integer in the i-th line should be b_{i,j}.

Examples

Input


2 2
1 2
2 3


Output


1 2
2 3


Input


2 3
16 16 16
16 16 16


Output


16 32 48
32 48 64


Input


2 2
3 11
12 8


Output


327 583
408 664

Note

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

In the third example: 

  * 327 is a multiple of 3, 583 is a multiple of 11, 408 is a multiple of 12, 664 is a multiple of 8; 
  * |408 - 327| = 3^4, |583 - 327| = 4^4, |664 - 408| = 4^4, |664 - 583| = 3^4. 

Solution (in JAVA):

Solution:
// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;






// Please name your class Main
public class Main {
    static Scanner in = new Scanner(System.in);
    public static void main (String[] args) throws java.lang.Exception {
        PrintWriter out = new PrintWriter(System.out);

        int T=1;
        for(int t=0;t<T;t++){
            int n=Int();int m=Int();
            int mat[][]=new int[n][m];
            for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
                    mat[i][j]=Int();
                }
            }

            Solution sol=new Solution();
            sol.solution(mat);

        }
        out.flush();
    }

    public static long Long(){
        return in.nextLong();
    }
    public static int Int(){
        return in.nextInt();
    }
    public static String Str(){
        return in.next();
    }
}


class Solution{

    public void solution(int mat[][]){
        //1<=mat[i][j]<=16
        //720,720 is the least common multiplier for all number

        int n=mat.length,m=mat[0].length;
        boolean visit[][]=new boolean[n][m];
        int res[][]=new int[n][m];
        Queue<int[]>q=new LinkedList<>();
        visit[0][0]=true;
        q.add(new int[]{0,0,0});

        while(q.size()!=0){
            int p[]=q.poll();
            int i=p[0],j=p[1],level=p[2];
            if(level%2==0){
                res[i][j]=720720;
            }
            else{
                res[i][j]=cal(mat[i][j]);
            }
            add(mat,q,visit,i+1,j,level+1);
            add(mat,q,visit,i-1,j,level+1);
            add(mat,q,visit,i,j+1,level+1);
            add(mat,q,visit,i,j-1,level+1);
        }




        for(int i=0;i<res.length;i++){
            for(int j=0;j<res[0].length;j++){
                System.out.print(res[i][j]+" ");
            }
            System.out.println();
        }
    }

    public int cal(int n){
        for(int i=1;i<=100;i++){
            if(((720720)-(i*i*i*i))%n==0){
                return ((720720)-(i*i*i*i));
            }
        }
        return -1;
    }

    public void add(int mat[][],Queue<int[]>q,boolean visit[][],int i,int j,int level){
        if(i<0||j<0||i>=mat.length||j>=mat[0].length||visit[i][j])return;
        visit[i][j]=true;
        q.add(new int[]{i,j,level});
    }

    public void msg(String s){
        System.out.println(s);
    }
}