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