#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << 0 << '\n';
    return 0;
  }
  if (n == 1 || m == 1) {
    int tot = 1;
    for (register int i = (1); i <= (n); ++i) {
      for (register int j = (1); j <= (m); ++j) {
        cout << (++tot) << ' ';
      }
      cout << '\n';
    }
    return 0;
  }
  for (register int i = (1); i <= (n); ++i) {
    for (register int j = (1); j <= (m); ++j) {
      int x = i + 1;
      int y = j + n;
      if (j == 1) y = 1;
      cout << x * y << ' ';
    }
    cout << '\n';
  }
  return 0;
}
