#include <bits/stdc++.h>
using namespace std;
mt19937 myrand(time(0));
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}
long long modexp(long long a, long long b, long long m) {
  long long r = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) r = (r * a) % m;
    b = b >> 1;
    a = (a * a) % m;
  }
  return r % m;
}
long long builtin_popcount(long long x) {
  long long cnt = 0;
  for (long long i = 60; i >= 0; i--) {
    if ((1LL << i) & x) cnt++;
  }
  return cnt;
}
long long addmod(long long a, long long b) {
  a %= 998244353;
  b %= 998244353;
  return (a + b) % 998244353;
}
long long mulmod(long long a, long long b) {
  a %= 998244353;
  b %= 998244353;
  return (a * b) % 998244353;
}
long long submod(long long a, long long b) {
  a %= 998244353;
  b %= 998244353;
  a -= b;
  if (a < 0) a += 998244353;
  return a % 998244353;
}
struct CustomCompare {
  bool operator()(long long a, long long b) { return a > b; }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  if (n == m && n == 1) {
    cout << 0;
    return 0;
  }
  if (m == 1) {
    for (int i = 0; i < n; i++) cout << i + 2 << "\n";
    return 0;
  }
  vector<long long> arr(m);
  for (int i = 0; i < m; i++) arr[i] = i + 2, cout << arr[i] << " ";
  cout << "\n";
  long long curr = m + 2;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) cout << curr * arr[j] << " ";
    cout << "\n";
    curr++;
  }
  return 0;
}
