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