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