#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  long long int n, i, j, p, k, m, ans = 0, r, c;
  cin >> r >> c;
  p = 0;
  if (c == 1) {
    p = 1;
    m = c;
    c = r;
    r = m;
  }
  vector<long long int> a[r];
  vector<long long int> tmp(c);
  for (i = 0; i < r; i++) {
    a[i] = tmp;
  }
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      a[i][j] = (i + 1) * (r + j + 1);
    }
  }
  if (r == 1 && c == 1)
    cout << 0 << endl;
  else {
    if (p == 0) {
      for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
          cout << a[i][j] << " ";
        }
        cout << endl;
      }
    } else {
      for (i = 0; i < c; i++) {
        for (j = 0; j < r; j++) {
          cout << a[j][i] << " ";
        }
        cout << endl;
      }
    }
  }
  return 0;
}
