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