#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using ull = unsigned long long; using Graph = vector>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define NP next_permutation const int INF32 = 2e9; const ll INF64 = 2e18; const ll mod = 998244353; // const ll mod = 1e9 + 7; template bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;} void cincout() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } int main() { cincout(); int X, Y; cin >> X >> Y; cout << X * Y << " " << X * Y << endl; for (int i = 1; i <= X - 1; i++) { cout << i << " " << i + 1 << endl; } int pre = -1, now = X; for (int i = 1; i <= X; i++) { pre = i; for (int j = 0; j < Y - 1; j++) { now++; cout << pre << " " << now << endl; pre = now; } } }