#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  long long mn = min(n, m);
  vector<pair<long long, long long> > vec;
  for (long long i = 0, j = mn; i <= min(n, m); i++, j--) {
    vec.push_back({j, i});
  }
  long long sz = vec.size();
  cout << sz << endl;
  for (long long i = 0; i < sz; i++) {
    cout << vec[i].first << " " << vec[i].second << endl;
  }
  return 0;
}
