#include <iostream>
#include <iomanip>
using namespace std;
void printArray(int m, int n, int *arr)
{
for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
cout.flags(ios::right);
cout << setw(5) << arr[i*n+j] << " ";
}
cout << endl;
}
}
int main()
{
int *arr;
int m=0,n=0;
cin>>m>>n;
arr=new int[m*n];
for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
arr[i*n+j] = 0;
// cout << i*n+j << " " << i << " " << j <<endl;
}
// cout << endl;
}
for(int i=0; i<n; i++)
{
arr[i] = 1;
}
for(int i=0; i<m; i++)
{
arr[n*i+0] = 1;
}
for(int i=1; i<m; i++)
{
for(int j=1; j<n; j++)
{
arr[i*n+j] = arr[(i-1)*n+j] + arr[i*n+(j-1)];
// cout << i*n+j << " " << i << " " << j <<endl;
}
// cout << endl;
}
printArray(m, n, arr);
delete []arr;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIHByaW50QXJyYXkoaW50IG0sIGludCBuLCBpbnQgKmFycikKewogICAgZm9yKGludCBpPTA7IGk8bTsgaSsrKQogICAgewogICAgICAgIGZvcihpbnQgaj0wOyBqPG47IGorKykKICAgICAgICB7CiAgICAgICAgICAgIGNvdXQuZmxhZ3MoaW9zOjpyaWdodCk7CiAgICAgICAgICAgIGNvdXQgPDwgc2V0dyg1KSA8PCBhcnJbaSpuK2pdIDw8ICIgIjsKICAgICAgICB9CiAgICAgICAgY291dCA8PCBlbmRsOwogICAgfQp9CgppbnQgbWFpbigpCnsKICAgIGludCAqYXJyOwogICAgaW50IG09MCxuPTA7CiAgICBjaW4+Pm0+Pm47CgogICAgYXJyPW5ldyBpbnRbbSpuXTsKCiAgICBmb3IoaW50IGk9MDsgaTxtOyBpKyspCiAgICB7CiAgICAgICAgZm9yKGludCBqPTA7IGo8bjsgaisrKQogICAgICAgIHsKICAgICAgICAgICAgYXJyW2kqbitqXSA9IDA7Ci8vICAgICAgICAgICAgY291dCA8PCBpKm4raiA8PCAiICAiIDw8IGkgPDwgIiAgIiA8PCBqIDw8ZW5kbDsKICAgICAgICB9Ci8vICAgICAgICBjb3V0IDw8IGVuZGw7CiAgICB9CgogICAgZm9yKGludCBpPTA7IGk8bjsgaSsrKQogICAgewogICAgICAgIGFycltpXSA9IDE7CiAgICB9CiAgICBmb3IoaW50IGk9MDsgaTxtOyBpKyspCiAgICB7CiAgICAgICAgYXJyW24qaSswXSA9IDE7CiAgICB9CgogICAgZm9yKGludCBpPTE7IGk8bTsgaSsrKQogICAgewogICAgICAgIGZvcihpbnQgaj0xOyBqPG47IGorKykKICAgICAgICB7CiAgICAgICAgICAgIGFycltpKm4ral0gPSBhcnJbKGktMSkqbitqXSArIGFycltpKm4rKGotMSldOwovLyAgICAgICAgICAgIGNvdXQgPDwgaSpuK2ogPDwgIiAgIiA8PCBpIDw8ICIgICIgPDwgaiA8PGVuZGw7CiAgICAgICAgfQovLyAgICAgICAgY291dCA8PCBlbmRsOwogICAgfQoKICAgIHByaW50QXJyYXkobSwgbiwgYXJyKTsKCgogICAgZGVsZXRlIFtdYXJyOwoKICAgIHJldHVybiAwOwp9Cg==