#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int MOD = 1000000007;
const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int grid[505][505];
signed main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(0);
  int r, c;
  cin >> r >> c;
  if (r == 1) {
    if (c == 1)
      cout << 0 << "\n", exit(0);
    else {
      int cur = 2;
      for (int i = 0; i < c; i++) cout << cur++ << ' ';
      exit(0);
    }
  }
  int cur = r + c;
  for (int i = 0; i < r; i++) {
    grid[i][0] = cur--;
  }
  for (int i = 0; i < r; i++) {
    int cur = 2;
    for (int j = 1; j < c; j++) {
      grid[i][j] = cur++ * grid[i][0];
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cout << grid[i][j] << ' ';
    }
    cout << "\n";
  }
  return 0;
}
