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