#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  bool dance[101][2];
  for (int i = 0; i <= 100; i++) {
    dance[i][0] = dance[i][1] = 0;
  }
  scanf("%d%d", &N, &M);
  vector<pair<int, int> > sol;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (!dance[i][0] || !dance[j][1]) {
        dance[i][0] = true;
        dance[j][1] = true;
        sol.push_back(make_pair(i, j));
      }
    }
  }
  printf("%d\n", sol.size());
  for (int i = 0; i < sol.size(); i++) {
    printf("%d %d\n", sol[i].first, sol[i].second);
  }
  return 0;
}
