#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin >> a >> b;
  int s[10000];
  int x = a, y = 0;
  s[0] = x;
  s[1] = y;
  int d = 2;
  x--;
  y++;
  while (x >= 0 && y <= b) {
    s[d++] = x--;
    s[d++] = y++;
  }
  cout << d / 2 << endl;
  for (int i = 0; i < d; i += 2) {
    cout << s[i] << ' ' << s[i + 1] << endl;
  }
}
