#include <bits/stdc++.h>
using namespace std;
int n, m, a[505][505];
int main() {
  scanf("%d %d", &n, &m);
  if (n == m && n == 1)
    printf("%d\n", 0);
  else {
    int ok = 0;
    if (n > m) swap(n, m), ok = 1;
    int dem = 1;
    for (int i = 1; i <= m; ++i) a[1][i] = ++dem;
    for (int i = 2; i <= n; ++i) {
      ++dem;
      for (int j = 1; j <= m; ++j) {
        a[i][j] = a[1][j] * dem;
      }
    }
    if (ok == 0) {
      for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) printf("%d ", a[i][j]);
        puts("");
      }
    } else {
      for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) printf("%d ", a[j][i]);
        puts("");
      }
    }
  }
  return 0;
}
