#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1e5 + 5;
constexpr int MAXW = 1e4 + 5;
constexpr int MOD = 998244353;
constexpr long long INF = 1e18;
constexpr int LOG = 11;
int n, m;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  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;
}
