#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << 0 << "\n";
    return 0;
  } else if (r == 1) {
    int cnt = 2;
    for (int i = 1; i <= c; ++i) {
      cout << cnt << " ";
      cnt++;
    }
    return 0;
  } else if (c == 1) {
    int cnt = 2;
    for (int i = 1; i <= r; ++i) {
      cout << cnt << "\n";
      cnt++;
    }
    return 0;
  }
  vector<vector<int>> a(r, vector<int>(c));
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      a[i][j] = (i + 1) * (r + (j + 1));
    }
  }
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
