#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i;
  cin >> n >> m;
  cout << min(n, m) + 1 << endl;
  for (i = 0; i < min(n, m) + 1; i++) {
    if (min(n, m) == n) {
      cout << i << " " << n - i << endl;
    } else {
      cout << m - i << " " << i << endl;
    }
  }
  return 0;
}
