#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MAXN = 3000;
int n, m;
vector<pair<int, int> > ans;
set<int> f, s;
int main() {
  cin >> n >> m;
  cerr << n << m << endl;
  int p = 0;
  for (int i = n; i >= 0; i--) {
    for (int j = p; j <= m; j++) {
      ans.push_back(make_pair(i, j));
      break;
    }
    p++;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << ' ' << ans[i].second << endl;
  return 0;
}
