#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, i, e, f, g, n, m, k, l, A[502][502], r;
int main() {
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << 0;
    return 0;
  }
  if (c == 1) {
    for (long long i = 1; i <= r; i++) cout << i + 1 << endl;
    return 0;
  }
  for (long long i = 1; i <= c; i++) {
    A[1][i] = r + i;
    cout << A[1][i] << " ";
  }
  cout << endl;
  for (long long i = 2; i <= r; i++) {
    for (long long j = 1; j <= c; j++) {
      A[i][j] = A[i - 1][j] + r + j;
      cout << A[i][j] << " ";
    }
    cout << endl;
  }
}
