#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++)
    ;
  printf("%d\n", n + m - 1);
  for (int i = 1; i <= n; i++) printf("%d %d\n", i, 1);
  for (int i = 2; i <= m; ++i) cout << 1 << " " << i << endl;
  return 0;
}
