#include #include #include using namespace std; using namespace atcoder; using ll = long long; //#define endl "\n"; ll x, y; vector> v; int main(){ cin >> x >> y; if(x == 3){ for(int i = 1; i < x; i++) v.push_back({i, i + 1}); v.push_back({x, 1}); ll nex = x + 1; for(int i = 1; i <= x; i++){ int pos = i; for(int j = 1; j < y; j++){ v.push_back({pos, nex}); pos = nex; nex++; } } cout << v.size() << " " << v.size() << endl; for(auto [a, b]: v) cout << a << " " << b << endl; }else{ for(int i = 1; i < x; i++) v.push_back({i, i + 1}); v.push_back({x, 1}); //ループをもう1個ふやす v.push_back({1, x / 2 + 1}); ll nex = x + 1; for(int i = 1; i <= x; i++){ if(i == 1 || i == x / 2 + 1) continue; int pos = i; for(int j = 1; j < y; j++){ v.push_back({pos, nex}); pos = nex; nex++; } } //のこり2y-2頂点のパスグラフ for(int i = 1; i < 2 * y - 2; i++){ v.push_back({nex, nex + 1}); nex++; } cout << v.size() << " " << v.size() << endl; for(auto [a, b]: v) cout << a << " " << b << endl; } return 0; }