#include <bits/stdc++.h>
using namespace std;
long long N, M, K, A, B, X, Y, Z, R, C, D, a, b, c, d, i, j, k;
long long dp[18][163][2];
void solve() {
  cin >> R >> C;
  if (R == 1 && C == 1) {
    cout << "0" << endl;
  } else if (R == 1) {
    for (long long i = 1; i <= C; i++) {
      cout << i + 1 << " ";
    }
  } else {
    for (long long i = 2; i <= R + 1; i++) {
      cout << i << " ";
      for (long long j = R + 2; j < R + 2 + C - 1; j++) {
        cout << i * j << " ";
      }
      cout << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
