#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, m;
  cin >> n >> m;
  vector<pair<long long int, long long int>> a;
  for (long long int i = 1; i <= 1; i++) {
    for (long long int j = 1; j <= m; j++) a.push_back(make_pair(i, j));
  }
  for (long long int i = 2; i <= n; i++) a.push_back(make_pair(i, 1));
  cout << a.size() << "\n";
  for (long long int i = 0; i < a.size(); i++)
    cout << a[i].first << " " << a[i].second << "\n";
  return 0;
}
