#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  long long res = 1LL;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
long long inv(long long n) { return power(n, 1000000007 - 2) % 1000000007; }
long long isprime(long long n) {
  if (n < 2) return 0;
  long long i;
  for (i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
void files() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long g = egcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return g;
}
const long long N = 2e6;
long long n, m;
void solve() {
  cin >> n >> m;
  long long i, j;
  cout << m + n - 1 << "\n";
  for (i = 1; i <= m; i++) cout << 1 << " " << i << "\n";
  for (i = 2; i <= n; i++) cout << i << " " << 1 << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
