#include <bits/stdc++.h>
using namespace std;
long long a[101][101];
int main() {
  long long n, m;
  cin >> n >> m;
  long long mn = min(m, n);
  cout << mn + 1 << endl;
  for (long long i = 0; i <= mn; i++)
    cout << i << " " << (mn - i) % (mn + 1) << endl;
}
