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