#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 5;
const long long mod = 1e9 + 7;
const int alphabet = 26;
const int inf = INT_MAX;
const long long linf = 1e18 + 9;
namespace util {
inline long long cnm(char ch) { return (ch - '0'); }
inline long long cap(char ch) { return (ch - 'a'); }
inline void instr(string& s, long long& n) {
  cin >> s;
  n = s.length();
}
inline void instr(string& s) { cin >> s; }
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
bool min(T a, T b, T c) {
  return std::min(a, std::min(b, c));
}
}  // namespace util
using namespace util;
long long ans[maxn][maxn];
void solve(int tc) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, m, n;
  cin >> n >> m;
  if (n == 1 and m == 1) {
    cout << "0";
    return;
  }
  if (n == 1) {
    for (i = 1; i <= m; i++) {
      ans[1][i] = i + 1;
      cout << ans[1][i] << " ";
    }
    return;
  }
  if (m == 1) {
    for (i = 1; i <= n; i++) {
      ans[i][1] = i + 1;
      cout << ans[i][1] << "\n";
    }
    return;
  }
  for (i = 1; i <= m; i++) {
    ans[1][i] = n + i;
  }
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      long long val = ans[1][j];
      ans[i][j] = val * i;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  int i = 1;
  while (i <= t) {
    solve(i);
    i++;
  }
  return 0;
}
