#include #include //小数点出力用 //cout << fixed << setprecision(10) << ans; #include #include #include #include #include #include #include using ll = long long; using namespace std; #define modP 998244353 bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); } int clk4(int num) { return (num - 2) * (num % 2); } void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int X, Y;cin >> X >> Y; cout << X * Y << " " << X * Y << endl; cout << 1 << " " << X << endl; for (int i = 1;i < X;i++) { cout << i << " " << i + 1 << " " << endl; } for (int i = 1;i < Y;i++) { for (int j = 1;j <= X;j++) { cout << (i - 1) * X + j << " " << i * X + j << " " << endl; } } return 0; }