#include <bits/stdc++.h>
using namespace std;
template <class T>
T power(T N, T P) {
  return (P == 0) ? 1 : N * power(N, P - 1);
}
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(), "w", stdout); }
bool sort_rev(int a, int b) { return a > b; }
bool sort_(pair<string, int> &p1, pair<string, int> &p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
int main() {
  int t = 1;
  while (t--) {
    int r, c;
    scanf("%d%d", &r, &c);
    if (r == 1 && c == 1)
      printf("0");
    else if (r == 1)
      for (int i = 1; i <= c; i++) printf("%d ", i + 1);
    else if (c == 1)
      for (int i = 1; i <= r; i++) printf("%d\n", i + 1);
    else {
      for (int i = 1; i <= r; i++) {
        for (int j = 1; j <= c; j++) printf("%d ", i * (j + r));
        printf("\n");
      }
    }
  }
  return 0;
}
