#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 10;
int n, m;
int main() {
  cin >> n >> m;
  cout << n + m - 1 << endl;
  cout << "1 1" << endl;
  for (int i = 2; i <= n; ++i) cout << i << " 1" << endl;
  for (int i = 2; i <= m; ++i) cout << "1 " << i << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
