#include <bits/stdc++.h>
using namespace std;
vector<long long> primeFactors(long long n) {
  vector<long long> a;
  while (n % 2 == 0) {
    a.push_back(2);
    n = n / 2;
  }
  for (long long i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      a.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) a.push_back(n);
  return a;
}
long long ceil(const long long &a, const long long &b) {
  if (a % b == 0) return a / b;
  return a / b + 1;
}
bool isPrime[1000000];
void makeSieve() {
  for (long long i = 0; i < 1000000; i++) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long i = 2; i * i < 1000000; i++) {
    if (isPrime[i] == true) {
      for (long long j = i * i; j < 1000000; j += i) {
        isPrime[j] = false;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  makeSieve();
  while (t--) {
    long long r, c;
    cin >> r >> c;
    if (r == 1 && c == 1) {
      cout << 0 << endl;
      continue;
    }
    if (r == 1 || c == 1) {
      bool flag = false;
      if (r != 1) {
        flag = true;
      }
      c = max(c, r);
      for (long long i = 2; i <= c + 1; i++) {
        cout << i << " ";
        if (flag) {
          cout << endl;
        }
      }
      continue;
    }
    long long a[r + 1][c + 1];
    long long itr = r;
    for (long long i = 1; i <= r; i++) {
      itr = r;
      for (long long j = 1; j <= c; j++) {
        a[i][j] = (i) * (itr + 1);
        itr++;
      }
    }
    for (long long i = 1; i <= r; i++) {
      for (long long j = 1; j <= c; j++) {
        cout << a[i][j] << " ";
      }
      cout << endl;
    }
  }
}
