#include <bits/stdc++.h>
using namespace std;
void test_case() {
  long long n, m, i, j, cnt;
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << "0\n";
    return;
  }
  if (n == 1) {
    cnt = 2;
    for (i = 0; i < m; i++) {
      cout << cnt << " ";
      cnt += 1;
    }
    return;
  }
  if (m == 1) {
    cnt = 2;
    for (i = 0; i < n; i++) {
      cout << cnt << "\n";
      cnt += 1;
    }
    return;
  }
  vector<long long> r(n), c(m);
  for (i = 0; i < n; i++) r[i] = i + 1;
  for (i = 0; i < m; i++) c[i] = n + i + 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      long long val = r[i] * c[j];
      cout << val << " ";
    }
    cout << "\n";
  }
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t;
  t = 1;
  while (t--) {
    test_case();
  }
  return 0;
}
