#include <bits/stdc++.h>
using namespace std;
long long mat[505][505];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      mat[i][j] = 1;
    }
  }
  if (r <= c) {
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        mat[i][j] *= i;
      }
    }
    for (int i = r + 1; i <= r + c; i++) {
      for (int j = 1; j <= r; j++) {
        mat[j][i - r] *= i;
      }
    }
  } else {
    for (int i = 1; i <= c; i++) {
      for (int j = 1; j <= r; j++) {
        mat[j][i] *= i;
      }
    }
    for (int i = c + 1; i <= r + c; i++) {
      for (int j = 1; j <= r; j++) {
        mat[i - c][j] *= i;
      }
    }
  }
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      cout << mat[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
