#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    cout << m + n - 1 << endl;
    for (int i = (1); i < (n + 1); i++) cout << i << ' ' << 1 << endl;
    for (int i = (2); i < (m + 1); i++) cout << 1 << ' ' << i << endl;
  }
  return 0;
}
