#include <bits/stdc++.h>
using namespace std;
int N = 100005;
int a, b, c, k, n, m, t, l, r, mx, fark, say, say2, top, q;
int main() {
  int n, m;
  cin >> n >> m;
  cout << (n - 1) + m << endl;
  for (int i = 1; i <= m; i++) cout << 1 << " " << i << endl;
  for (int i = 1; i < n; i++) cout << i + 1 << " " << m << endl;
  return 0;
}
