#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k, p;
  cin >> n >> m;
  cout << m + n - 1 << endl;
  for (j = 1; j <= m; j++) {
    cout << "1"
         << " " << j << endl;
  }
  for (i = 2; i <= n; i++) {
    cout << i << " " << m << endl;
  }
  return 0;
}
