#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int x, y; cin >> x >> y; cout << x * y << ' ' << x * y << endl; // 丸い部分 rep(i, x) cout << i + 1 << ' ' << (i + 1) % x + 1 << endl; // 伸びてる部分 rep(i, x) { rep(j, y - 1) cout << i + 1 + x * j << ' ' << i + 1 + x * (j + 1) << endl; } return 0; }