#include #include int gcd (int a, int b) { if (b <= 0) { return a; } return gcd(b, a%b); } int cmp_r (const void *a, const void *b) { long long *a_ = (long long *)a; long long *b_ = (long long *)b; if (a_[0]*b_[1] < a_[1]*b_[0]) { return -1; } if (a_[0]*b_[1] > a_[1]*b_[0]) { return 1; } return 0; } int main () { int cnt = 0; int sum = 3; long long a[1000000][2] = {}; int n = 0; long long tmp = 0LL; long long x = 1000000000LL; long long y = 0LL; while (cnt < 125000) { for (int i = 1; 2*i < sum; i++) { int j = sum-i; if (gcd(i, j) == 1) { a[cnt][0] = (long long)i; a[cnt][1] = (long long)j; cnt++; } } sum++; } while (n < 125000 && tmp+a[n][0]+a[n][1] <= 1000000000LL) { tmp += a[n][0]+a[n][1]; n++; } qsort(a, n, sizeof(long long)*2, cmp_r); printf("%d\n", 8*n); for (int i = 0; i < n; i++) { x -= a[i][0]; y += a[i][1]; printf("%lld %lld\n", x, y); } for (int i = n-1; i >= 0; i--) { x -= a[i][1]; y += a[i][0]; printf("%lld %lld\n", x, y); } for (int i = 0; i < n; i++) { x -= a[i][1]; y -= a[i][0]; printf("%lld %lld\n", x, y); } for (int i = n-1; i >= 0; i--) { x -= a[i][0]; y -= a[i][1]; printf("%lld %lld\n", x, y); } for (int i = 0; i < n; i++) { x += a[i][0]; y -= a[i][1]; printf("%lld %lld\n", x, y); } for (int i = n-1; i >= 0; i--) { x += a[i][1]; y -= a[i][0]; printf("%lld %lld\n", x, y); } for (int i = 0; i < n; i++) { x += a[i][1]; y += a[i][0]; printf("%lld %lld\n", x, y); } for (int i = n-1; i >= 0; i--) { x += a[i][0]; y += a[i][1]; printf("%lld %lld\n", x, y); } return 0; }