#include <bits/stdc++.h>
using namespace std;
int i, j, k;
int BinarySearch(int a[], int l, int h, int x);
int BS_first_occurence(int a[], int n, int x);
int BS_first_occurence(int a[], int n, int x);
int main() {
  int n, m;
  cin >> n >> m;
  cout << n + m - 1 << "\n";
  for (i = 1; i <= m; i++) {
    cout << 1 << ' ' << i << "\n";
  }
  for (i = 2; i <= n; i++) {
    cout << i << ' ' << 1 << "\n";
  }
}
