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