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