#include <bits/stdc++.h>
using namespace std;
int b[101], g[101];
int main() {
  int i, j, flag, n, m, c = 0;
  vector<pair<int, int>> v;
  cin >> n >> m;
  b[1] = 1;
  g[1] = 1;
  v.emplace_back(1, 1);
  for (;;) {
    flag = 0;
    for (i = 1; i <= n; i++) {
      if (b[i] == 1) break;
    }
    for (j = 1; j <= m; j++) {
      if (g[j] == 0) break;
    }
    if (i != n + 1 && j != m + 1) {
      g[j] = 1;
      v.emplace_back(i, j);
      flag = 1;
    }
    for (i = 1; i <= n; i++) {
      if (b[i] == 0) break;
    }
    for (j = 1; j <= m; j++) {
      if (g[j] == 1) break;
    }
    if (i != n + 1 && j != m + 1) {
      b[i] = 1;
      v.emplace_back(i, j);
      flag = 1;
    }
    if (flag == 0) break;
  }
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++) {
    cout << v[i].first << ' ' << v[i].second << endl;
  }
  return 0;
}
