#include int main () { int n = 0; int m = 0; int max = 0; int x = 1000000000; int y = 0; for (int i = 1; i < 1000000000/i; i++) { long long idx[2] = { 0LL, 1000001LL }; long long used = ((long long)i)*((long long)(i+2)); while (idx[1] - idx[0] > 1LL) { long long nxt = (idx[0]+idx[1])/2LL; if ((nxt*(nxt+3LL))/2LL-5LL <= 1000000000LL-used) { idx[0] = nxt; } else { idx[1] = nxt; } } if (i+((int)idx[0]) > max) { n = i; m = (int)(idx[0]); max = n+m; } } printf("%d\n", (n+m-2)*8); for (int i = m; i > 2; i--) { x -= 1; y += i; printf("%d %d\n", x, y); } for (int i = 1; i <= n; i++) { x -= i; y += i+1; printf("%d %d\n", x, y); } for (int i = n; i > 0; i--) { x -= i+1; y += i; printf("%d %d\n", x, y); } for (int i = 2; i <= m; i++) { x -= i; y += 1; printf("%d %d\n", x, y); } for (int i = m; i > 2; i--) { x -= i; y -= 1; printf("%d %d\n", x, y); } for (int i = 1; i <= n; i++) { x -= i+1; y -= i; printf("%d %d\n", x, y); } for (int i = n; i > 0; i--) { x -= i; y -= i+1; printf("%d %d\n", x, y); } for (int i = 2; i <= m; i++) { x -= 1; y -= i; printf("%d %d\n", x, y); } for (int i = m; i > 2; i--) { x += 1; y -= i; printf("%d %d\n", x, y); } for (int i = 1; i <= n; i++) { x += i; y -= i+1; printf("%d %d\n", x, y); } for (int i = n; i > 0; i--) { x += i+1; y -= i; printf("%d %d\n", x, y); } for (int i = 2; i <= m; i++) { x += i; y -= 1; printf("%d %d\n", x, y); } for (int i = m; i > 2; i--) { x += i; y += 1; printf("%d %d\n", x, y); } for (int i = 1; i <= n; i++) { x += i+1; y += i; printf("%d %d\n", x, y); } for (int i = n; i > 0; i--) { x += i; y += i+1; printf("%d %d\n", x, y); } for (int i = 2; i <= m; i++) { x += 1; y += i; printf("%d %d\n", x, y); } return 0; }