#include <bits/stdc++.h>
using namespace std;
string s, curt;
long long pos;
long long gcd(long long x, long long y) { return !x ? y : (gcd(y % x, x)); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long r, c;
  cin >> r >> c;
  vector<long long> primes = {1};
  vector<bool> prime(20001, true);
  prime[0] = prime[1] = false;
  for (long long i = 2; i <= 20000; i++) {
    if (prime[i]) {
      primes.push_back(i);
      for (long long j = i + i; j <= 20000; j += i) {
        prime[j] = false;
      }
    }
  }
  if (r == 1 && c == 1) {
    cout << 0;
    return 0;
  }
  if (r == 1) {
    for (long long i = 1; i <= c; i++) {
      cout << i + 1 << " ";
    }
    return 0;
  }
  if (c == 1) {
    for (long long i = 1; i <= r; i++) {
      cout << i + 1 << "\n";
    }
    return 0;
  }
  long long ind = 0;
  vector<vector<long long>> ans(r, vector<long long>(c, 1));
  for (long long i = 0; i < r; i++) {
    for (long long j = 0; j < c; j++) {
      ans[i][j] *= (ind + 1);
    }
    ind++;
  }
  for (long long i = 0; i < c; i++) {
    for (long long j = 0; j < r; j++) {
      ans[j][i] *= (ind + 1);
    }
    ind++;
  }
  for (long long i = 0; i < r; i++) {
    for (long long j = 0; j < c; j++) cout << ans[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
