#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline long long read1() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int a[510][510];
int main() {
  int r = read();
  int c = read();
  if (r == 1 && c == 1) {
    puts("0");
    return 0;
  }
  if (r == 1) {
    for (int i = 2; i <= c + 1; i++) printf("%d ", i);
    return 0;
  }
  if (c == 1) {
    for (int i = 2; i <= r + 1; i++) printf("%d\n", i);
    return 0;
  }
  for (int i = 1; i <= c; i++) a[1][i] = i + 1;
  for (int i = 2; i <= r; i++)
    for (int j = 1; j <= c; j++) a[i][j] = 1;
  for (int i = 2; i <= r; i++)
    for (int j = 1; j <= c; j++) a[i][j] = a[1][j] * (c + i) * (j + 1);
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) printf("%d ", a[i][j]);
    puts("");
  }
  return 0;
}
