#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
const long long ninf = -1e12;
const long long mod = 1e9 + 7;
const long double EPS = 1e-8;
template <typename A, typename B>
bool mini(A &x, const B &y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}
template <typename A, typename B>
bool maxi(A &x, const B &y) {
  if (y >= x) {
    x = y;
    return true;
  }
  return false;
}
void run() {
  long long n, m;
  cin >> n >> m;
  long long ma = n + m;
  if (m == 1) {
    if (n == 1) {
      cout << 0;
      return;
    }
  }
  if (m == 1) {
    for (long long i = 2; i <= n + 1; ++i) {
      cout << i << '\n';
    }
    return;
  }
  long long f = 0;
  long long t = 1;
  vector<vector<long long> > res;
  res.resize(n);
  for (long long i = 0; i < n; ++i) {
    res[i].assign(m, 1);
    for (long long j = 0; j < m; ++j) {
      res[i][j] *= t;
    }
    ++t;
  }
  for (long long i = 0; i < m; ++i) {
    for (long long j = 0; j < n; ++j) {
      res[j][i] *= t;
    }
    ++t;
  }
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      cout << res[i][j] << " ";
    }
    cout << '\n';
  }
  return;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  srand(time(nullptr));
  long long que = 1;
  for (long long i = 0; i < que; ++i) {
    run();
  }
  return 0;
}
