#include // clang-format off using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair; const ll INF=4e18; void print0(){}; template void print0(H h,T... t){cout<void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);} void perr0(){}; template void perr0(H h,T... t){cerr<void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);} void ioinit() { cout<; namespace rational { struct rational { int numer; // 分子 int denom; // 分母 double todouble() { return double(numer) / denom; } int floor() { return numer / denom; } int ceil() { return (numer + denom - 1) / denom; } pii topii() { return {numer, denom}; } }; int _gcd(int a, int b) { if (b == 0) { return a; } return _gcd(b, a % b); } rational _reduce(int n, int d) { if (d == 0) { // assert(false); if (n > 0) { return {1, 0}; } else if (n < 0) { return {-1, 0}; } else { return {0, 0}; } } else if (n == 0) { return {0, 1}; } else if (d < 0) { n = -n; d = -d; int g = _gcd(abs(n), d); return {n / g, d / g}; } else { int g = _gcd(abs(n), d); return {n / g, d / g}; } } rational operator-(const rational& x) { return rational{-x.numer, x.denom}; } rational inv(const rational& x) { if (x.numer < 0) { return rational{-x.denom, -x.numer}; } return rational{x.denom, x.numer}; } rational operator+(const rational& lhs, const rational& rhs) { return _reduce(lhs.numer * rhs.denom + rhs.numer * lhs.denom, lhs.denom * rhs.denom); } rational operator*(const rational& lhs, const rational& rhs) { return _reduce(lhs.numer * rhs.numer, lhs.denom * rhs.denom); } rational operator-(const rational& lhs, const rational& rhs) { return lhs + (-rhs); } rational operator/(const rational& lhs, const rational& rhs) { return lhs * inv(rhs); } int _sub_numer(const rational& lhs, const rational& rhs) { return lhs.numer * rhs.denom - rhs.numer * lhs.denom; } bool operator<(const rational& lhs, const rational& rhs) { return _sub_numer(lhs, rhs) < 0; } bool operator>(const rational& lhs, const rational& rhs) { return _sub_numer(lhs, rhs) > 0; } bool operator==(const rational& lhs, const rational& rhs) { return _sub_numer(lhs, rhs) == 0; } bool operator<=(const rational& lhs, const rational& rhs) { return _sub_numer(lhs, rhs) <= 0; } bool operator>=(const rational& lhs, const rational& rhs) { return _sub_numer(lhs, rhs) >= 0; } ostream& operator<<(ostream& os, const rational& a) { return os << a.numer << "/" << a.denom; } rational init(int n, int d) { return _reduce(n, d); } }; // namespace rational int main() { ioinit(); vector rats; const int MX = 641; for (int x = 1; x <= MX; x++) { for (int y = 1; y <= MX; y++) { if (x == 577 && y <= 355) continue; auto rat = rational::init(y, x); rats.push_back(rat); } } sort(rats.rbegin(), rats.rend()); { vector tmp; for (auto r : rats) { if (tmp.size() && tmp.back() == r) { continue; } tmp.push_back(r); } rats = tmp; } // const int BASEY = 80267797; // const int BASEX = 80126150; vector result; { pii cur = {1, 1}; vector points; for (auto rat : rats) { points.push_back(cur); pii d = rat.topii(); pii nxt = {cur.first + d.second, cur.second + d.first}; cur = nxt; } for (auto p : points) { result.push_back(p); } int BASEX = points.back().first + 1; reverse(points.begin(), points.end()); for (auto p : points) { pii q = {BASEX + BASEX - p.first, p.second}; result.push_back(q); } auto revrslt = result; reverse(revrslt.begin(), revrslt.end()); int miny = 1; for (auto p : revrslt) { pii q = {p.first, -p.second}; result.push_back(q); miny = min(miny, q.second); } vector upresult; for (auto p : result) { upresult.push_back({p.first, p.second + abs(miny) + 1}); } result = upresult; } print(result.size()); for (auto r : result) { print(r.first, r.second); } return 0; }