시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 0 0 0 0.000%

문제

Technical committee members were working late and ordered a pizza. When they were delivered a round, tasty and satisfying pizza, they faced a problem: they wanted to cut this pizza as quickly as possible.

Each technical committee member announced the number $\alpha_i$, which describes how much pizza she wants to eat. For convenience, they decided to use the angular measure of the desired piece in degrees: the number $\alpha_i$ means that this person wants to get exactly one piece of pizza in the form of a sector with an angular measure of $\alpha_i$ degrees.

They use a special pizza knife to cut pizza. It can make two types of cuts: straight cuts from the center of the pizza to the edge (the knife passes the radius of the circle) and straight cuts from one edge to the other edge through the center (the knife passes the diameter of the circle). After cutting, the obtained sectors can be distributed in any order, one to each eater, and the remaining pieces remain in the box.

What is the minimum number of cuts they need to make, so that each member of the technical committee gets exactly the requested piece of pizza?

입력

The first line contains an integer $n$ --- the size of the technical committee ($1 \le n \le 16$). The next line contains $n$ integers $\alpha_i$ --- angular measures in degrees of the desired pizza sectors ($1 \le \alpha_i < 360$).

It is guaranteed that the sum of all $\alpha_i$ does not exceed $360$.

출력

Output the integer $m$ in the first line --- the minimum number of cuts they need. Output descriptions of the cuts in the next $m$ lines.

Each cut is represented by two integers $\beta_i$ ($0 \le \beta_i < 360$) and $type_i$ --- the rotation angle and the type of the cut. The rotation angle is measured from a fixed axis in a fixed direction (for example, from a north-directed axis, clockwise). The type of the cut $type_i$ is $0$ if the knife passes the radius, and is $1$ if the knife passes the diameter.

예제 입력 1

4
90 90 90 90

예제 출력 1

2
0 1
90 1

예제 입력 2

2
30 30

예제 출력 2

2
0 1
30 1

예제 입력 3

3
200 80 80

예제 출력 3

3
0 0
200 0
280 0