#include <bits/stdc++.h>
const int Max = 2006;
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  if (max(n, m) == 1) {
    cout << "0\n";
    return;
  }
  if (min(n, m) == 1) {
    for (int i = 1; i <= max(n, m); i++) cout << i + 1 << ' ';
    cout << "\n";
    return;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << i * (n + j) << ' ';
    }
    cout << "\n";
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
