#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (n == 1 && m == 1) return cout << 0, 0;
  set<int> se;
  for (int i = 1; i <= min(n, m); i++) se.insert(i * 2);
  if (m <= n) {
    for (int i = 1; i <= m; i++) cout << i * 2 << " ";
    cout << endl;
    for (int i = 1, c = 2; i < n; i++) {
      while (se.count(c)) c++;
      cout << c << " ";
      se.insert(c);
      for (int j = 2; j <= m; j++) {
        cout << c * j * 2 << " ";
      }
      cout << endl;
    }
  } else {
    cout << 2 << " ";
    vector<int> v;
    v.push_back(2);
    for (int i = 1, c = 2; i < m; i++) {
      while (se.count(c)) c++;
      cout << (c) << " ";
      v.push_back(c);
      se.insert(c);
    }
    cout << endl;
    for (int i = 2, c = 2; i <= n; i++) {
      cout << i * 2 << " ";
      for (int j = 1; j < m; j++) {
        cout << i * 2 * v[j] << " ";
      }
      cout << endl;
    }
  }
}
