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