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