#include <bits/stdc++.h>
using namespace std;
void Yes() { printf("Yes\n"); }
void No() { printf("No\n"); }
const long long mod = 1e9 + 7;
template <typename T>
T gcf(T a, T b) {
  return (b == 0) ? a : gcf(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / gcf(a, b);
}
template <typename T>
T sumTo(T x) {
  return x * (x + 1) / 2;
}
template <typename T>
T sumSquaresTo(T x) {
  return x * (x + 1) * (2 * x + 1) / 6;
}
template <typename T>
T ceilDiv(T n, T d) {
  return (n + d - 1) / d;
}
void solve() {
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << 0;
    return;
  } else if (c == 1) {
    for (int i = 1; i <= r; i++) printf("%d\n", i + 1);
    return;
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      printf("%d ", i * (j + r));
    }
    printf("\n");
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
