#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (c == 1) {
    int term = 2;
    for (int i = 0; i < r; i++) {
      cout << term << endl;
      term++;
    }
    return 0;
  }
  if (r == 1) {
    int term = 2;
    for (int i = 0; i < c; i++) {
      cout << term << " ";
      term++;
    }
    return 0;
  }
  long long int temp = 2;
  vector<int> v;
  int col = max(r, c);
  int row = min(r, c);
  vector<vector<long long int>> ans(row, vector<long long int>(col, 0));
  int k = ((row + col) % 2 == 1) ? row + col + 1 : row + col + 2;
  bool flag = 0;
  for (int i = 1; i <= col; i++) {
    ans[0][i - 1] = temp;
    v.push_back(temp);
    if (temp == 2)
      temp++;
    else {
      if (!flag && temp + 2 <= row + col)
        temp += 2;
      else {
        flag = 1;
        temp = k - 2;
        k -= 2;
      }
    }
  }
  temp = 4;
  for (int i = 2; i <= row; i++) {
    for (int j = 1; j <= col; j++) {
      ans[i - 1][j - 1] = (v[j - 1] * temp);
    }
    temp += 2;
  }
  if (c > r) {
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cout << ans[i][j] << " ";
      }
      cout << endl;
    }
  } else {
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cout << ans[j][i] << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
