#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 5;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int r, c;
  scanf("%d%d", &r, &c);
  if (r + c == 2) {
    puts("0");
    exit(0);
  }
  vector<vector<int>> a(r, vector<int>(c));
  int k1, k2;
  k1 = k2 = 0;
  if (c >= r)
    for (int i = 0; i < r; i++) {
      k1++;
      k2 = r;
      for (int j = 0; j < c; j++) {
        k2++;
        a[i][j] = k1 * k2;
      }
    }
  else {
    for (int i = 0; i < c; i++) {
      k1++;
      k2 = c;
      for (int j = 0; j < r; j++) {
        k2++;
        a[j][i] = k2 * k1;
      }
    }
  }
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++)
      printf("%d%c", a[i][j], j != c - 1 ? ' ' : '\n');
  return 0;
}
