Problem list
Log in
#coci00227 · COCI 2011/2012 Contest 6

Rez

Gold V 1.0 s 32 MB

Let‟s say that there exists a huge cake made from blueberries, strawberries and chocolate. It‟s shaped like a square, and has area of 100 square meters. Proffesionals strongly advise that cake is being cut with wet knife and eaten with dry spoon. Also:  Every cut begins and ends on the cake‟s perimeter  A cut cannot lie completely on one of the sides  No two cuts have the same starting and ending points, i.e. all cuts are different Parts obtained by these cuts are separated and counted only after last cut has been made. During cutting, the cake keeps its square form. At least how many cuts need to be made in order to obtain at least K parts? Exactly what cuts to make?

Input

The first and only line of input contains an integer K ($1 \le K \le 1,000,000$), minimum number of parts that we must have after cutting is done.

Output

The first line of output should contain the requested number of cuts, N. The following N lines should have four integers each, coordinates of starting and ending point for each cut made. Coordinates are represented in millimeters, and opposing corners of the cake have coordinates (-5000, -5000) and (5000, 5000). So for each point (x, y) lying on the side of the square, the following will hold: max( |x|, |y| ) = 5000.

Constraints

If only the number of cuts N is correct, you will get 50% of the points for that test case.

Example 1

Input
1
Output
0

Example 2

Input
4
Output
2
-5000 -5000 5000 5000
5000 -5000 -5000 5000

Example 3

Input
7
Output
3
-5000 5000 0 -5000
-2000 -5000 5000 5000
-5000 0 5000 0
Source
COCI 2011/2012 Contest 6
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code