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