#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, r, c;
  vector<long long int> v;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << "0";
    return 0;
  } else if (r == 1 || c == 1) {
    if (r == 1) {
      for (int i = 2; i <= c + 1; i++) {
        cout << i << " ";
      }
    } else {
      for (int i = 2; i <= r + 1; i++) {
        cout << i << "\n";
      }
    }
    return 0;
  }
  long long int s = r + c;
  long long int i1 = c + 1;
  while (i1 <= s) {
    for (int j = 1; j <= c; j++) {
      cout << i1 * j << " ";
    }
    i1 += 1;
    cout << endl;
  }
}
