#include <bits/stdc++.h>
using namespace std;
void solution() {
  long long m1, m2;
  cin >> m1 >> m2;
  cout << m1 + m2 - 1 << endl;
  for (int i = 1; i <= m2; i++) cout << 1 << " " << i << endl;
  for (int i = 2; i <= m1; i++) cout << i << " " << 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long t = 1;
  while (t--) solution();
}
