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