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