#include <cstdio>
#include <iostream>
#include <vector>
using namespace std; int main(){
int n,m;
cin >> n >> m;
cout<<n+m-1<<endl;
for(int i = 1; i <= m ; i ++) cout<<1<<" "<<i<<endl;
for(int i = 2; i <= n; i ++ ) cout<<i<<" "<<m<<endl;
return 0;
}
2022-10-28 14:34:13
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std; int main(){
int n,m;
cin >> n >> m;
cout<<n+m-1<<endl;
for(int i = 1; i <= m ; i ++) cout<<1<<" "<<i<<endl;
for(int i = 2; i <= n; i ++ ) cout<<i<<" "<<m<<endl;
return 0;
}