#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0, f = 1;
  register char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
  return x * f;
}
inline long long Mul(long long a, long long b) {
  return 1ll * a * b % 1000000007;
}
inline long long Inc(long long a, long long b) {
  return (a += b) >= 1000000007 ? a - 1000000007 : a;
}
inline long long Dec(long long a, long long b) {
  return (a -= b) < 0 ? a + 1000000007 : a;
}
inline long long qpow(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = Mul(r, a);
    a = Mul(a, a), b >>= 1;
  }
  return r;
}
long long n, m, a[2333], b[2333];
signed main() {
  n = read(), m = read();
  if (n == 1 && m == 1) return puts("0"), 0;
  if (n == 1) {
    for (long long i = (1), iLimit = (m); i <= iLimit; ++i)
      printf("%d ", i + 1);
    return 0;
  }
  if (m == 1) {
    for (long long i = (1), iLimit = (n); i <= iLimit; ++i)
      printf("%d\n", i + 1);
    return 0;
  }
  for (long long i = (1), iLimit = (n); i <= iLimit; ++i) a[i] = i;
  for (long long j = (1), jLimit = (m); j <= jLimit; ++j) b[j] = j + n;
  for (long long i = (1), iLimit = (n); i <= iLimit; ++i) {
    for (long long j = (1), jLimit = (m); j <= jLimit; ++j)
      printf("%d ", a[i] * b[j]);
    puts("");
  }
  return 0;
}
