#include <bits/stdc++.h>
using namespace std;
int R, C;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> R >> C;
  if (R == 1 && C == 1) {
    cout << "0\n";
    return 0;
  }
  if (R == 1) {
    for (long long c = 0; c < C; c++) {
      cout << c + 2 << " ";
    }
    cout << "\n";
    return 0;
  }
  if (C == 1) {
    for (long long r = 0; r < R; r++) {
      cout << r + 2 << "\n";
    }
    return 0;
  }
  for (long long r = 0; r < R; r++) {
    for (long long c = 0; c < C; c++) {
      cout << (r + 1) * (c + R + 1) << " ";
    }
    cout << "\n";
  }
  return 0;
}
