#include <bits/stdc++.h>
using namespace std;
long long n, m, ans[505][505], cnt;
bool f = false;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  if (n == m && n == 1) {
    cout << 0;
    return 0;
  }
  if (n > m) {
    f = true;
    swap(n, m);
  }
  for (int i = n; i >= 1; i--) {
    cnt++;
    ans[i][0] = cnt;
  }
  for (int j = 1; j <= m; j++) {
    cnt++;
    ans[0][j] = cnt;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) ans[i][j] = ans[0][j] * ans[i][0];
  if (!f)
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) cout << ans[i][j] << " ";
      cout << '\n';
    }
  else
    for (int j = 1; j <= m; j++) {
      for (int i = 1; i <= n; i++) cout << ans[i][j] << " ";
      cout << '\n';
    }
  return 0;
}
