#include <bits/stdc++.h>
using namespace std;
int p[200], q[200], b, g, c;
int main() {
  cin >> b >> g;
  c = 0;
  for (int i = 1; i <= b; i++)
    for (int j = 1; j <= g; j++) {
      if (p[i] != 1 || q[j] != 1) {
        p[i] = 1;
        q[j] = 1;
        c++;
      }
    }
  cout << c << "\n";
  for (int i = 1; i <= b; i++)
    for (int j = 1; j <= g; j++) {
      if (p[i] != 2 || q[j] != 2) {
        p[i] = 2;
        q[j] = 2;
        cout << i << " " << j << "\n";
      }
    }
}
