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