#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1)
    cout << 0;
  else if (r == 1) {
    for (int j = 1; j <= c; j++) {
      printf("%d ", j + 1);
    }
  } else if (c == 1) {
    for (int j = 1; j <= r; j++) {
      printf("%d\n", j + 1);
    }
  } else {
    int sum = r + c;
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) printf("%d ", sum * j);
      printf("\n");
      sum--;
    }
  }
}
