#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 1e9;
void solve() {
  int n, m;
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << "0\n";
    return;
  }
  if (n == 1) {
    for (int i = 0; i < m; i++) {
      cout << i + 2 << " ";
    }
    return;
  }
  if (m == 1) {
    for (int i = 0; i < n; i++) {
      cout << i + 2 << "\n";
    }
    return;
  }
  vector<int> v, p;
  v.push_back(2);
  p.push_back(1);
  for (int i = 1; i < n; i++) {
    v.push_back(i + 2);
  }
  for (int i = 1; i < m; i++) {
    p.push_back(n + i + 1);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << v[i] * p[j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios::sync_with_stdio(0);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
}
