#include <bits/stdc++.h>
using namespace std;
long long ceil(long long a, long long b) {
  long long res = a / b;
  if (res * b != a) res++;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    int n, m;
    cin >> n >> m;
    int ans = min(n, m) + 1;
    cout << ans << endl;
    for (int i = n, j = 0; i >= 0 && j <= m; i--, j++)
      if (i != 0 || j != 0) cout << i << " " << j << endl;
  }
}
