#include <bits/stdc++.h>
#include <cmath>
#include <sstream>
#include <vector>
#include <stdio.h>
#define ll              long long
#define fr(i,j,p)       for(ll i=j; i<p ;i++)
#define frr(i,j,p)      for(ll i=j; i>=p ;i--)
#define PI              3.14159265358979323846
#define print(m)        std::cout << std::fixed << std::setprecision(11) << m <<endl;
#define mkp             make_pair
#define pb              push_back
#define M               32
#define lbindex(a,x)    (int)(lower_bound(a.begin(), a.end(),x)-a.begin());
#define upindex(a,x)    (int)(upper_bound(a.begin(), a.end(),x)-a.begin());
#define all(a)          (a).begin(),(a).end()
#define mem(b,a,n)      memset(b,a,sizeof(b[0])*n);
#define meme(b,a,n,m)   memset(b,a,sizeof(b[0][0])*n*m);
#define ff              first
#define ss              second
#define endl            '\n'

//ll md=1000000007;
//ll mdd=998244353;

using namespace std;

typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);  cout.tie(NULL);
    int n,m;    cin>>n>>m;
    vvi b(n, vi(m,720720));
    fr(i,0,n)
    {
        fr(j,0,m)
        {
            int x;  cin>>x;
            if((i+j)%2)   b[i][j]+=(x*x*x*x);
            cout<<b[i][j]<<' ';
        }
        cout<<endl;
    }
    return 0;
}
