void check(const deque>& dq) { ll vy1 = dq[0].first-dq[1].first; ll vx1 = dq[0].second-dq[1].second; ll vy2 = dq[1].first-dq[2].first; ll vx2 = dq[1].second-dq[2].second; if (vy1*vx2 < vy2*vx1) { cout << vx1 << " " << vy1 << " " << vx2 << " " << vy2 << endl; abort(); } } { set> li; REP(i, 1500) { const int vy = i + 1; REP(j, 1500) { const int vx = j + 1; int g = gcd(vy, vx); li.emplace(vy/g, vx/g); } } int n = 1000000; wt(n); n -= 2; ll y = 0, x = 0; // ll oy = 0, ox = 0; ll oy = 500000000, ox = 500000000; wt(0-oy, 0-ox); auto it = li.begin(); deque> q; q.emplace_back(0, 0); REP(_, n) { assert(it != li.end()); y += it->first; x += it->second; wt(y-oy, x-ox); ++it; q.emplace_back(y, x); if (q.size() == 3) check(q); if (q.size() > 4) q.pop_front(); } wt(0-oy, x-ox); cout.flush(); }