#include <bits/stdc++.h>
using namespace std;
template <typename T>
T prod(const T &a, const T &b, const T &mod) {
  return ((a % mod) * (b % mod)) % mod;
}
template <typename T>
T pow_(const T &a, const T &b) {
  if (!b) return 1;
  T p = pow_(a, b / 2);
  p *= p;
  return (b % 2) ? (p * a) : p;
}
template <typename T>
T modpow(const T &a, const T &b, const T &mod) {
  if (!b) return 1;
  T p = modpow(a, b / 2);
  p = prod(p, p);
  return (b % 2) ? (prod(p, a)) : p;
}
template <typename T>
T max(const T &a, const T &b, const T &c) {
  return max(a, max(b, c));
}
template <typename T>
T min(const T &a, const T &b, const T &c) {
  return min(a, min(b, c));
}
template <typename T>
void dbg(const vector<T> &a, int l, int r) {
  for (long long int i = l; i <= r; i++) cout << a[i] << " ";
  cout << endl;
}
template <typename T>
void dbg(const vector<T> &a) {
  for (long long int i = 0; i <= a.size() - 1; i++) cout << a[i] << " ";
  cout << endl;
}
void main_() {
  long long int n, m;
  cin >> n >> m;
  cout << min(n, m) + 1 << endl;
  n = min(n, m);
  vector<pair<long long int, long long int> > ans;
  for (long long int i = 0; i <= n; i++) ans.push_back(make_pair(i, n - i));
  for (long long int i = 0; i <= ans.size() - 1; i++) {
    for (long long int j = 0; j <= ans.size() - 1; j++)
      if (i == j)
        continue;
      else {
        long long int dis = (abs(ans[i].first - ans[j].first) *
                             abs(ans[i].first - ans[j].first)) +
                            (abs(ans[i].second - ans[j].second) *
                             abs(ans[i].second - ans[j].second));
        long long int root = sqrt(dis);
        if ((root * root) == dis) {
          cout << root << " " << dis << endl;
          cout << ans[i].first << " " << ans[i].second << endl;
          cout << ans[j].first << " " << ans[j].second << endl;
          cout << "-1\n";
          return;
        }
      }
  }
  for (long long int i = 0; i <= n; i++) cout << i << " " << n - i << endl;
}
int main() {
  { main_(); }
  return 0;
}
