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