#include <bits/stdc++.h>
using namespace std;
int n, m, k, a, b, x, y, i;
int main() {
  cin >> n >> m;
  cout << min(n, m) + 1 << endl;
  while (i <= n && m >= 0) {
    cout << i << " " << m << endl;
    i++;
    m--;
  }
}
