#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int i, j, k, l, m, n, t, r, cnt;
  int flag = 0;
  long long ans = 0, an = 0;
  t = 1;
  while (t--) {
    cin >> n >> m;
    cout << min(n, m) + 1 << endl;
    int x, y;
    x = 0;
    y = m;
    while (x <= n && y >= 0) {
      cout << x << " " << y << endl;
      x++;
      y--;
    }
  }
}
