Cutting pizza
시간 제한1초메모리 제한512 MB
합이 360도 이하인 최대 16개의 부채꼴 각도 요청이 주어질 때, 반지름 절단과 지름 절단만 사용해 모든 요청을 정확히 만족시키는 최소 절단 횟수를 구하고 그 절단들을 출력한다.
문제
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 , 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 means that this person wants to get exactly one piece of pizza in the form of a sector with an angular measure of 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 --- the size of the technical committee (). The next line contains integers --- angular measures in degrees of the desired pizza sectors ().
It is guaranteed that the sum of all does not exceed .
출력
Output the integer in the first line --- the minimum number of cuts they need. Output descriptions of the cuts in the next lines.
Each cut is represented by two integers () and --- 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 is if the knife passes the radius, and is if the knife passes the diameter.