#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
int main() {
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    printf("0\n");
  } else if (r == 1) {
    for (int i = 1; i <= c; ++i) printf("%d ", i + 1);
    puts("");
  } else if (c == 1) {
    for (int i = 1; i <= r; ++i) printf("%d\n", i + 1);
  } else {
    vector<int> row(c + 1);
    for (int i = 1; i <= c; ++i) row[i] = r + i, printf("%d ", row[i]);
    puts("");
    for (int i = 2; i <= r; ++i) {
      for (int j = 1; j <= c; ++j) printf("%d ", row[j] * i);
      puts("");
    }
  }
}
