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