#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  int a[c];
  if (r == 1 && c == 1)
    cout << 0 << endl;
  else if (c > 1) {
    for (int i = 0; i < c; i++) {
      a[i] = r + i + 1;
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 0; j < c; j++) {
        cout << i * a[j] << " ";
      }
      cout << endl;
    }
  } else {
    for (int i = 0; i < r; i++) {
      cout << i + 2 << endl;
    }
  }
  return 0;
}
