#include <bits/stdc++.h>
using namespace std;
vector<int> cat(100005);
vector<int> vec[100005];
vector<int> level(100005, -1);
void bfs(int s) {
  queue<int> q;
  if (cat[s] == 1)
    level[s] = 1;
  else
    level[s] = 0;
  q.push(s);
  while (!q.empty()) {
    s = q.front();
    q.pop();
    for (int j = 0; j < vec[s].size(); j++) {
      if (level[vec[s][j]] == -1) {
        if (cat[vec[s][j]] == 1)
          level[vec[s][j]] = level[s] + 1;
        else
          level[vec[s][j]] = level[s];
        q.push(vec[s][j]);
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  int k = min(n, m) + 1;
  cout << k << "\n";
  for (int i = 0; i < k; i++) {
    cout << i << " " << (min(m, n) - i) << "\n";
  }
}
