#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  if (r == c and r == 1) return cout << 0, 0;
  if (r == 1) {
    for (int i = 0; i < c; i++) cout << 2 + i << " ";
    return 0;
  }
  if (c == 1) {
    for (int i = 0; i < r; i++) cout << 2 + i << " ";
    return 0;
  }
  int ans[r][c];
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) ans[i][j] = 1;
  int val = r + c;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) ans[i][j] = val;
    val--;
  }
  for (int j = 0; j < c; j++) {
    for (int i = 0; i < r; i++) {
      ans[i][j] = ans[i][j] * val;
    }
    val--;
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}
