#include <bits/stdc++.h>
using namespace std;
signed main() {
  std ::ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long m, n;
  cin >> m >> n;
  if (m == 1 && n == 1) {
    cout << 0;
    return 0;
  }
  if (m == 1) {
    for (long long i = 0; i < n; i++) cout << 2 + i << ' ';
    return 0;
  } else if (n == 1) {
    for (long long i = 0; i < m; i++) cout << 2 + i << '\n';
    return 0;
  }
  vector<vector<long long> > a(m, vector<long long>(n));
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < n; j++) a[i][j] = (i + 1) * (m + j + 1);
  }
  for (long long i = 0; i < m; i++)
    for (long long j = 0; j < n; j++) cout << a[i][j] << " \n"[j == n - 1];
}
