#include <bits/stdc++.h>
using namespace std;
long long r, c, rg[505], cg[505], tab[505][505];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> r >> c;
  for (long long i = 1; i <= r; i++) {
    rg[i] = i;
  }
  for (long long i = 1; i <= c; i++) cg[i] = i + r;
  if (r == c and r == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (c == 1) swap(cg[1], rg[1]);
  for (long long i = 1; i <= r; i++) {
    for (long long j = 1; j <= c; j++) {
      tab[i][j] = rg[i] * cg[j];
      cout << tab[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
