#include <bits/stdc++.h>
using namespace std;
const long long int sz = 100010, sz2 = 1000010;
long long int toint(const string &s) {
  stringstream ss;
  ss << s;
  long long int x;
  ss >> x;
  return x;
}
string tostring(long long int number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
int main() {
  int n, m;
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << 0;
  } else if (n == 1) {
    for (int j = 0; j < m; j++) {
      cout << j + 2 << " ";
    }
  } else if (m == 1) {
    for (int i = 0; i < n; i++) {
      cout << i + 2 << endl;
    }
  } else {
    vector<vector<int> > a(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        a[i][j] = (i + 1) * (j + 1 + n);
        cout << a[i][j] << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
