#include #include #include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; #define rep(i, n) for (int i = 0; i< (int)(n); i++) int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int x, y; cin >> x >> y; cout << x*y << " " << x*y << endl; rep(i, x){ cout << i+1 << " " << (i+2 <= x ? i+2 : 1)<< endl; } int cnt = x+1; rep(i, x){ int now = i+1; rep(j, y-1){ cout << now << " " << cnt << endl; now = cnt; cnt++; } } return 0; }