#include <bits/stdc++.h>
using namespace std;
int freq[256];
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  cout << n + m - 1 << endl;
  for (int i = 1; i <= (int)n; i++) cout << i << " 1" << endl;
  for (int i = 2; i <= m; i++) cout << "1 " << i << endl;
  return 0;
}
