#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m;
  cin >> n >> m;
  long long k = min(n + 1, m + 1);
  cout << k << endl;
  for (long long i = 0; i < k; i++) cout << i << " " << k - i - 1 << endl;
}
