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