#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > v1;
  int a, b;
  cin >> a >> b;
  int x = 1, y = 1;
  int minimum = min(a, b);
  int maximum = max(a, b);
  int reverse = 0;
  if (maximum == a) reverse = 1;
  while (true) {
    v1.push_back(make_pair(x, y));
    if (x == y)
      y++;
    else {
      if (x < minimum)
        x++;
      else
        y++;
    }
    if (x > minimum) break;
    if (y > maximum) break;
  }
  cout << v1.size() << endl;
  for (int i = 0; i < v1.size(); i++) {
    if (reverse == 0)
      cout << v1[i].first << " " << v1[i].second << endl;
    else
      cout << v1[i].second << " " << v1[i].first << endl;
  }
}
