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