#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long r, c;
  cin >> r >> c;
  if (r == c && r == 1) {
    cout << 0;
    return 0;
  }
  if (c == 1) {
    for (long long i = 2; i <= r + 1; ++i) {
      for (long long j = 1; j <= c; ++j) {
        cout << i << " ";
      }
      cout << "\n";
    }
    return 0;
  }
  for (long long i = 1; i <= r; ++i) {
    for (long long j = 1; j <= c; ++j) {
      cout << i * (j + r) << " ";
    }
    cout << "\n";
  }
  return 0;
}
