#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smn(T &a, const T &b) {
  if (b < a) a = b;
}
template <class T>
inline void smx(T &a, const T &b) {
  if (b > a) a = b;
}
template <class T>
inline T _rev(const T &a) {
  T _ = a;
  reverse(_.begin(), _.end());
  return _;
}
const double eps = 1e-8;
const long double leps = 1e-14;
int n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  cout << n + m - 1 << '\n';
  for (int i = 1; i <= m; i++) cout << "1 " << i << '\n';
  for (int i = 2; i <= n; i++) cout << i << " 1" << '\n';
  return 0;
}
