#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int r, c;
  cin >> r >> c;
  if (r == 1 && c == 1) {
    cout << "0";
  } else {
    if (c != 1) {
      int a[r][c], i, j;
      int k = 2;
      for (i = 0; i < c; i++) {
        a[r - 1][i] = k;
        k++;
      }
      int temp[r];
      for (i = 0; i < r - 1; i++) {
        temp[i] = k;
        k++;
      }
      temp[r - 1] = 1;
      for (i = 0; i < r - 1; i++) {
        for (j = 0; j < c; j++) {
          int x = a[r - 1][j];
          a[i][j] = x * temp[i];
        }
      }
      for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
          cout << a[i][j] << " ";
        }
        cout << "\n";
      }
    } else {
      for (int i = 2; i < 2 + r; i++) {
        cout << i << "\n";
      }
    }
  }
}
