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