#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
void rw() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, p = 0;
  cin >> n >> m;
  map<long long, long long> s, r;
  vector<long long> t;
  while (n >= 0 && p <= m) {
    t.push_back(n);
    t.push_back(p);
    n--, p++;
  }
  cout << t.size() / 2 << "\n";
  for (int i = 0; i <= t.size() - 2; i += 2)
    cout << t[i] << " " << t[i + 1] << "\n";
  return 0;
}
