#include <bits/stdc++.h>
using namespace std;
signed main() {
  int64_t n, m, k = 0;
  cin >> n >> m;
  cout << min(n, m) + 1 << '\n';
  while (k <= n && m >= 0) {
    cout << k << ' ' << m << '\n';
    ++k;
    --m;
  }
}
