#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, g;
  bool b = false;
  cin >> n >> m;
  cout << (n + (m - 1)) << endl;
  if (n > m) {
    g = m;
    m = n;
    n = g;
    b = true;
  }
  for (int i = 1; i <= m; i++) {
    if (b == true) {
      cout << i << " " << 1 << endl;
    } else {
      cout << 1 << " " << i << endl;
    }
  }
  for (int i = 1; i < n; i++) {
    if (b == true) {
      cout << i << " " << i + 1 << endl;
    } else {
      cout << i + 1 << " " << i << endl;
    }
  }
  return 0;
}
