#include <bits/stdc++.h>
using namespace std;
const int OHT = 100100;
const int MAXINF = (2 << 26);
const int MININF = (~(2 << 26));
int vis1[110], vis2[110];
int main() {
  int n, m, i, j;
  cin >> n >> m;
  vector<pair<int, int> > v;
  for (i = 2; i <= n; i++) v.push_back(make_pair(i, 1));
  for (j = 1; j <= m; j++) v.push_back(make_pair(1, j));
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
