#include <bits/stdc++.h>
using namespace std;
std::string intToString(long i) {
  std::stringstream ss;
  std::string s;
  ss << i;
  s = ss.str();
  return s;
}
int stringToInt(string i) {
  std::stringstream ss;
  int s;
  ss << i;
  ss >> s;
  return s;
}
int main() {
  int n, m;
  cin >> n >> m;
  long ans = m + (n - 1);
  cout << ans << endl;
  for (int j = 1; j <= m; j++) {
    cout << 1 << " " << j << endl;
  }
  for (int i = 2; i <= n; i++) {
    cout << i << " " << 1 << endl;
  }
  return 0;
}
