#include <bits/stdc++.h>
using namespace std;
int ma[505][505];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int r, c;
  cin >> r >> c;
  if (r == c && c == 1) {
    cout << 0 << '\n';
  } else {
    int k = 2;
    if (r == 1) {
      for (int i = 0; i < c; i++) cout << k++ << " \n"[i == c - 1];
    } else if (c == 1) {
      for (int i = 0; i < r; i++) cout << k++ << '\n';
    } else {
      for (int i = 1; i <= r; i++) ma[i][1] = k++;
      for (int i = 2; i <= c; i++) ma[1][i] = k++;
      for (int i = r; i >= 1; i--) {
        for (int j = 2; j <= c; j++) {
          ma[i][j] = ma[1][j] * ma[i][1];
        }
      }
      for (int i = 1; i <= r; i++) {
        for (int j = 1; j <= c; j++) {
          cout << ma[i][j] << " \n"[j == c];
        }
      }
    }
  }
  return 0;
}
