#include <bits/stdc++.h>
using namespace std;
const int SS = 5e2 + 123;
const int N = 1e5 + 123;
const int NN = 1e6 + 123;
const int M = 1e7 + 123;
const int MM = 1e8 + 123;
const int inf = 1e9 + 123;
const long long INF = 1e18 + 123;
const long long MAXN = 1e10 + 123;
const long long MOD = 1e9 + 123;
const long long mod = 555557;
const double pi = acos(-1.0);
int n, m;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  cout << n + m - 1 << endl;
  if (n > m) {
    for (int i = 1; i <= n; i++) cout << i << " " << 1 << endl;
    for (int i = 2; i <= m; i++) cout << 1 << " " << i << endl;
  } else {
    for (int i = 1; i <= m; i++) cout << 1 << " " << i << endl;
    for (int i = 2; i <= n; i++) cout << i << " " << 1 << endl;
  }
}
