#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 10, MOD = 1000 * 1000 * 1000 + 7,
          INF = 2 * 1000 * 1000 * 1000;
const double EPS = 1e-9;
int main() {
  ios::sync_with_stdio(false);
  int n, m, i, j;
  while (cin >> n >> m) {
    cout << n + m - 1 << endl;
    for (j = 1; j <= m; j++) cout << 1 << " " << j << endl;
    for (i = 2; i <= n; i++) cout << i << " " << 1 << endl;
  }
  return 0;
}
