#include <bits/stdc++.h>
using namespace std;
const int N = 1e9;
int main() {
  int r, c;
  scanf("%d %d", &r, &c);
  if (r == 1 && c == 1) {
    printf("%d", 0);
    return 0;
  }
  if (r == 1) {
    for (int i = 1; i <= c; i++) {
      printf("%d ", i + 1);
    }
    return 0;
  } else if (c == 1) {
    for (int i = 1; i <= r; i++) {
      printf("%d\n", i + 1);
    }
    return 0;
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      printf("%d ", i * (j + r));
    }
    printf("\n");
  }
}
