#include <bits/stdc++.h>
using namespace std;
int b, g;
void start() {
  cin >> b >> g;
  cout << b + g - 1 << '\n';
  int i = 1, j = 1, times = 0;
  bool flag = false;
  while (i <= b && j <= g) {
    if (g >= b) {
      cout << i << " " << j << '\n';
      i += (times == 0 || i == b) ? 0 : ((times % 2 == 1) ? 1 : 0);
      j += (times == 0 || (i == b && flag)) ? 1 : ((times % 2 == 0) ? 1 : 0);
      flag = (i == b) ? true : false;
      times++;
    } else {
      cout << i << " " << j << '\n';
      j += (times == 0 || j == g) ? 0 : ((times % 2 == 1) ? 1 : 0);
      i += (times == 0 || (j == g && flag)) ? 1 : ((times % 2 == 0) ? 1 : 0);
      flag = (j == g) ? true : false;
      times++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  start();
  return 0;
}
