#include <bits/stdc++.h>
using namespace std;
namespace Fast {
inline char getc() {
  static char buf[1 << 21], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline void read() {}
template <typename T1, typename... T2>
inline void read(T1 &x, T2 &...oth) {
  bool f = false;
  x = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch - 48);
    ch = getchar();
  }
  x = f ? -x : x;
  read(oth...);
}
template <typename T>
inline void print(T x) {
  if (x < 0) {
    putchar('-');
    x = ~(x - 1);
  }
  char f[100];
  int top = 0;
  while (x) f[++top] = x % 10 + '0', x /= 10;
  if (!top) f[++top] = '0';
  while (top) putchar(f[top--]);
}
template <typename T>
inline void print(T x, char c) {
  print(x);
  putchar(c);
}
}  // namespace Fast
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Fast::read;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LLF = 0x3f3f3f3f3f3f3f3f;
const int M = 2e5 + 10;
template <typename T>
T gcd(T a, T b, T m = 0) {
  while (b) m = a % b, a = b, b = m;
  return a;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
inline void input_arr(T *a, int l, int r) {
  while (l < r) read(a[l++]);
}
int ans[510][510];
void solve() {
  int r, c;
  read(r, c);
  if (r == 1 && c == 1) {
    puts("0");
    return;
  }
  int cnt = 1;
  if (r > c) {
    for (int i = 1; i <= c; ++i) ans[0][i] = cnt++;
    for (int j = 1; j <= r; ++j) ans[j][0] = cnt++;
  } else {
    for (int j = 1; j <= r; ++j) ans[j][0] = cnt++;
    for (int i = 1; i <= c; ++i) ans[0][i] = cnt++;
  }
  for (int i = 1; i <= r; ++i) {
    for (int j = 1; j <= c; ++j) {
      Fast::print(lcm(ans[0][j], ans[i][0]), ' ');
    }
    puts("");
  }
}
clock_t ___;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int _;
  _ = 1;
  ___ = clock();
  while (_--) solve();
  return 0;
}
