#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
int main()
{
fastio
ll r,c;
cin>>r>>c;
if(r==1&&c==1)
{
cout<<0;
return 0;
}
ll mat[r][c]={{0,0},
{0,0}};
if(r>c)
{
//if(c!=1)
for(ll i=0;i<c;i++)
{
mat[0][i]=(i+1)*2;
}
ll a=2;
for(ll i=0;i<r;i++)
{
mat[i][0]=a++;
}
for(ll i=1;i<r;i++)
for(ll j=1;j<c;j++)
mat[i][j]=mat[i][0]*mat[0][j];
}
else
{ //if(r!=1)
for(ll i=0;i<r;i++)
{
mat[i][0]=(i+1)*2;
}
ll a=2;
for(ll i=0;i<c;i++)
{
mat[0][i]=a++;
}
for(ll i=1;i<r;i++)
for(ll j=1;j<c;j++)
mat[i][j]=mat[i][0]*mat[0][j];
}
for(auto& it:mat)
{
for(auto a:it)
cout<<a<<" ";
cout<<endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBmYXN0aW8gaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsgY2luLnRpZSgwKTsKI2RlZmluZSBsbCBsb25nIGxvbmcgaW50CgoKaW50IG1haW4oKQp7CiAKIGZhc3RpbwpsbCByLGM7CmNpbj4+cj4+YzsKaWYocj09MSYmYz09MSkKewogICAgY291dDw8MDsKICAgIHJldHVybiAwOwp9CmxsIG1hdFtyXVtjXT17ezAsMH0sCiAgICAgICAgICAgICAgezAsMH19OwoKaWYocj5jKQp7Ci8vaWYoYyE9MSkKZm9yKGxsIGk9MDtpPGM7aSsrKQp7CiAgICBtYXRbMF1baV09KGkrMSkqMjsKfQpsbCBhPTI7CmZvcihsbCBpPTA7aTxyO2krKykKewogICAgbWF0W2ldWzBdPWErKzsKfQoKZm9yKGxsIGk9MTtpPHI7aSsrKQogICAgZm9yKGxsIGo9MTtqPGM7aisrKQogICAgICAgIG1h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