#include using namespace std; int main(){ int x,y; cin >> x >> y; cout << x*y << " " << x*y << endl; for(int i = 0; i < x; i++){ for(int j = 0; j < y; j++){ if(j==y-1 && i == x-1){ cout << i+y*j << " " << i+y*j+1-x << endl; }else if(j==y-1){ cout << i+y*j << " " << i+y*j+1 << endl; }else{ cout << i+y*j << " " << i+y*(j+1) << endl; } } } }