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.*;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;

public class Main {

    public static void main(String[] args) {

        Parser parser = Parser.getInstance();
        int t = 1;
        for (int i = 1; i <= t; i++) {
            Problem problem = new Problem();
            problem.solve(i);
        }
    }
}

class Problem {
    private static final Parser parser = Parser.getInstance();
    private static final Printer printer = Printer.getInstance();

    public Problem() {

    }

    public void solve() {
    }

    public void solve(int testNum) {
        int n = parser.parseInt();
        int m = parser.parseInt();

        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                int v = parser.parseInt();
                if(i % 2 == 0 && j % 2 == 0) {
                    stringBuilder.append(720720).append(" ");
                } else if(i % 2 == 1 && j % 2 == 1) {
                    stringBuilder.append(720720).append(" ");
                } else {
                    stringBuilder.append(720720 + v * v * v * v).append(" ");
                }
            }
            stringBuilder.append("\n");
        }

        System.out.println(stringBuilder);
    }
}

class SegmentTree {
    private final int size;
    private final long[] data;
    private final long[] lazy;
    private final BiFunction<Long, Long, Long> updateFunction;

    public SegmentTree(long[] array, BiFunction<Long, Long, Long> updateFunction) {
        size = array.length;
        data = new long[size * 4];
        lazy = new long[size * 4];
        this.updateFunction = updateFunction;
        init(array, 1, 0, size - 1);
    }

    private long init(long[] array, int node, int start, int end) {
        if (start == end) {
            return data[node] = array[start];
        }
        int mid = (start + end) / 2;
        return data[node] = updateFunction.apply(init(array, node * 2, start, mid), init(array, node * 2 + 1, mid + 1, end));
    }

    public void updateRange(int l, int r, long diff) {
        updateRange(1, 0, size - 1, l, r, diff);
    }

    private void updateRange(int node, int start, int end, int l, int r, long diff) {
        propagation(node, start, end);
        if (isOutOfRange(start, end, l, r)) return;
        if (isAllIn(start, end, l, r)) {
            lazy[node] += diff;
            propagation(node, start, end);
            return;
        }

        int mid = (start + end) / 2;
        updateRange(node * 2, start, mid, l, r, diff);
        updateRange(node * 2 + 1, mid + 1, end, l, r, diff);
        data[node] = updateFunction.apply(data[node * 2], data[node * 2 + 1]);
    }

    public long get(int l, int r) {
        return get(1, 0, size - 1, l, r);
    }

    private long get(int node, int start, int end, int l, int r) {
        propagation(node, start, end);
        if (isOutOfRange(start, end, l, r)) return 0;
        if (isAllIn(start, end, l, r)) return data[node];
        int mid = (start + end) / 2;
        return updateFunction.apply(get(node * 2, start, mid, l, r), get(node * 2 + 1, mid + 1, end, l, r));
    }

    private void propagation(int node, int start, int end) {
        long v = lazy[node];
        data[node] = updateFunction.apply(data[node], (end - start + 1) * v);
        if (start != end) {
            lazy[node * 2] += v;
            lazy[node * 2 + 1] += v;
        }
        lazy[node] = 0;
    }

    private boolean isOutOfRange(int start, int end, int l, int r) {
        return l > end || r <= start;
    }

    private boolean isAllIn(int start, int end, int l, int r) {
        return l <= start && end < r;
    }
}

class MathUtil {

    public static List<Integer> getPrimes(int r) {
        if (r < 2) {
            return new ArrayList<>();
        }

        List<Integer> result = new ArrayList<>();
        result.add(2);
        boolean[] is = new boolean[r + 1];
        for (int i = 4; i <= r; i += 2) {
            is[i] = true;
        }
        for (int i = 3; i <= r; i += 2) {
            if (is[i]) continue;
            result.add(i);
            for (long j = (long) i * i; j <= r; j += i) {
                is[(int) j] = true;
            }
        }
        return result;
    }

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

    public static long pow(long x, long y) {
        return pow(x, y, Function.identity());
    }

    public static long pow(long x, long y, long mod) {
        return pow(x, y, v -> v % mod);
    }

    private static long pow(long x, long y, Function<Long, Long> action) {
        long res = 1;
        long t = x;
        while (y > 0) {
            if ((y & 1) == 1) {
                res *= t;
                res = action.apply(res);
            }
            t *= t;
            t = action.apply(t);
            y /= 2;
        }
        return res;
    }
}

class DisjointSet {

    private final int[] f;
    private final int[] counts;
    private int size;

    public DisjointSet(int size) {
        this.size = size;
        this.f = new int[size];
        for (int i = 0; i < size; i++) {
            f[i] = i;
        }
        this.counts = new int[size];
        for (int i = 0; i < size; i++) {
            counts[i] = 1;
        }
    }

    public int find(int u) {
        if (f[u] == u) return u;
        return f[u] = find(f[u]);
    }

    public boolean merge(int u, int v) {
        u = find(u);
        v = find(v);
        if (u == v) return false;
        if (u > v) {
            int t = u;
            u = v;
            v = t;
        }
        f[u] = v;
        counts[v] += counts[u];
        return true;
    }

    public int getCounts(int v) {
        return counts[find(v)];
    }

    public void debug() {
        System.out.println(Arrays.toString(f));
    }
}

class IntPair {
    private int l;
    private int r;

    public IntPair(int l, int r) {
        this.l = l;
        this.r = r;
    }

    public int getL() {
        return l;
    }

    public void setL(int l) {
        this.l = l;
    }

    public int getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IntPair pair = (IntPair) o;
        return l == pair.l &&
                r == pair.r;
    }

    @Override
    public int hashCode() {
        return Objects.hash(l, r);
    }
}

class Parser {
    private static final Parser PARSER = new Parser();
    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private StringTokenizer tokenizer;

    public int parseInt() {
        fill();
        return Integer.parseInt(tokenizer.nextToken());
    }

    public long parseLong() {
        fill();
        return java.lang.Long.parseLong(tokenizer.nextToken());
    }

    public double parseDouble() {
        fill();
        return Double.parseDouble(tokenizer.nextToken());
    }

    public String parseLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    String parseString() {
        fill();
        return tokenizer.nextToken();
    }

    private void fill() {
        while (tokenizer == null || !tokenizer.hasMoreElements()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static Parser getInstance() {
        return PARSER;
    }
}

class Printer {
    private static final Printer PRINTER = new Printer();
    private static final StringBuilder sb = new StringBuilder();

    public <T> Printer append(T o) {
        sb.append(o);
        return PRINTER;
    }

    public void print() {
        System.out.print(sb.toString());
        sb.setLength(0);
    }

    public static Printer getInstance() {
        return PRINTER;
    }
}