#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<pair<int, int>> vec;
  cin >> n >> m;
  int a = 0;
  while (m >= 0 && a <= n) {
    vec.push_back({a, m});
    a = a + 1;
    m = m - 1;
  }
  cout << vec.size() << endl;
  for (int i = 0; i < vec.size(); i++)
    cout << vec[i].first << " " << vec[i].second << endl;
}
