#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, i = 0, j;
  cin >> n >> m;
  j = n;
  while (j >= 0 && i <= m) {
    vec.push_back(make_pair(j, i));
    j--;
    i++;
  }
  cout << vec.size() << "\n";
  for (int i = 0; i < vec.size(); ++i) {
    cout << vec[i].first << " " << vec[i].second << "\n";
  }
  return 0;
}
