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:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Random;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sarthakmanna
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DMultiplesAndPowerDifferences solver = new DMultiplesAndPowerDifferences();
        solver.solve(1, in, out);
        out.close();
    }

    static class DMultiplesAndPowerDifferences {
        final static Helper hp = new Helper();

        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int i, j, k;
            // Editorial approach

            int N = in.nextInt(), M = in.nextInt();
            int[][] A = new int[N][M];

            long[] ar = new long[16];
            for (i = 0; i < 16; ++i) ar[i] = i + 1;
            int lcm = (int) hp.lcm(ar);

            int[][] ans = new int[N][M];
            for (i = 0; i < N; ++i)
                for (j = 0; j < M; ++j) {
                    A[i][j] = in.nextInt();
                    ans[i][j] = lcm;
                    if ((i + j) % 2 == 0) {
                        ans[i][j] += hp.pow(A[i][j], 4, Integer.MAX_VALUE - 7);
                    }
                }

            for (int[] row : ans) out.println(hp.joinElements(row));
        }

    }

    static class Helper {
        public final long MOD;
        public final int MAXN;
        final Random rnd;

        public Helper() {
            MOD = 1000_000_007;
            MAXN = 1000_006;
            rnd = new Random();
        }

        public Helper(long mod, int maxn) {
            MOD = mod;
            MAXN = maxn;
            rnd = new Random();
        }

        public String joinElements(int... ar) {
            StringBuilder sb = new StringBuilder();
            for (int itr : ar) sb.append(itr).append(" ");
            return sb.toString().trim();
        }

        public long gcd(long a, long b) {
            return b == 0 ? a : gcd(b, a % b);
        }

        public long lcm(long a, long b) {
            return a * b / gcd(a, b);
        }

        public long lcm(long... ar) {
            long ret = ar[0];
            for (long itr : ar) ret = lcm(ret, itr);
            return ret;
        }

        public long pow(long base, long exp, long MOD) {
            base %= MOD;
            long ret = 1;
            while (exp > 0) {
                if ((exp & 1) == 1) ret = ret * base % MOD;
                base = base * base % MOD;
                exp >>= 1;
            }
            return ret;
        }

    }

    static class FastReader {
        static final int BUFSIZE = 1 << 20;
        static byte[] buf;
        static int index;
        static int total;
        static InputStream in;

        public FastReader(InputStream is) {
            try {
                in = is;
                buf = new byte[BUFSIZE];
            } catch (Exception e) {
            }
        }

        private int scan() {
            try {
                if (index >= total) {
                    index = 0;
                    total = in.read(buf);
                    if (total <= 0)
                        return -1;
                }
                return buf[index++];
            } catch (Exception | Error e) {
                System.err.println(e.getMessage());
                return 13 / 0;
            }
        }

        public int nextInt() {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+')
                c = scan();
            for (; c >= '0' && c <= '9'; c = scan())
                val = (val << 3) + (val << 1) + (c & 15);
            return neg ? -val : val;
        }

    }
}