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