#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  cout << m + n - 1 << endl;
  for (int i = 0; i < m; i++) {
    cout << 1 << " " << i + 1 << endl;
  }
  for (int i = 1; i < n; i++) {
    cout << i + 1 << " " << 1 << endl;
  }
}
