#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 109;
void fastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  fastIO();
  long long r, c, ans[505][505];
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << 0;
    return 0;
  }
  if (r == 1) {
    for (int i = 2; i < c + 2; i++) cout << i << " ";
    return 0;
  }
  for (int i = 2; i < r + 2; i++) ans[i - 2][0] = i;
  for (int i = r + 2; i < r + c + 2; i++)
    for (int j = 2; j < r + 2; j++) ans[j - 2][i - r - 1] = i / gcd(i, j) * j;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) cout << ans[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
