#include <bits/stdc++.h>
using namespace std;
const int N = 500005, mod = 1000000007;
long long int a, b, c, d, e, f, g, h[N], arr[1000][1000];
string s;
vector<long long int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> a >> b;
  if (a == 1 and b == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (b == 1) {
    for (long long int i = 1; i <= a; i++) {
      arr[i][1] = i + 1;
    }
  } else {
    for (long long int i = 1; i <= a; i++) {
      for (long long int j = 1; j <= b; j++) {
        arr[i][j] = arr[i - 1][j] + a + j;
      }
    }
  }
  for (long long int i = 1; i <= a; i++) {
    for (long long int j = 1; j <= b; j++) {
      cout << arr[i][j] << ' ';
    }
    cout << endl;
  }
}
