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