#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e13;
const double PI = acos(-1);
const long long M = 1e9 + 7;
int a[510][510];
int vis[10010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    return cout << 0 << endl, 0;
  }
  if (c >= r) {
    int x = 4;
    for (int i = 1; i < r; ++i) a[i][0] = x, x += 2, vis[x - 2] = 1;
    x = 2;
    for (int i = 0; i < c; ++i) {
      while (vis[x]) x++;
      a[0][i] = x;
      x++;
    }
  } else {
    int x = 4;
    for (int i = 1; i < c; ++i) a[0][i] = x, x += 2, vis[x - 2] = 1;
    x = 2;
    for (int i = 0; i < r; ++i) {
      while (vis[x]) x++;
      a[i][0] = x;
      x++;
    }
  }
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      if (a[i][j] != 0)
        cout << a[i][j] << ' ';
      else
        cout << a[i][0] * a[0][j] << ' ';
    }
    cout << endl;
  }
}
