|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|3 초||512 MB||7||3||3||75.000%|
Stripes is a two player game. Necessary requisites are a board and rectangular stripes in three colours: red, green and blue. All the red stripes have dimensions c x 1, green - z x 1, and blue - n x 1, where c, z and n are integers. Players have at their disposal an unlimited pool of stripes of each colour.
A game board is a rectangle of dimensions p x 1 and consists of p fields of size 1 x 1.
Players make their moves by turns. Move consists of laying a stripe of any colour on the board. There are the following rules in force:
The first player is this one, who makes the first move in the game. It is said, that the first player has a winning strategy, if independently of the moves of the second player he can always win.
Write a program which:
The first line of the standard input consists of three integers c, z and n, 1 ≤ c,z,n ≤ 1,000, equal to the lengths of stripes, adequately: red, green and blue ones. Numbers in the line are separated by single spaces.
The second line of the standard input consists of one number m, 1 ≤ m ≤ 1,000, which is equal to the number of different boards to consider. Lines from the 3-rd to the (m+2)-th consists of one number p, 1 ≤ p < 1,000. Number in the (i+2)-th line is the length of the i-th board.
The standard output should contain m lines. Only one number should be written in the i-th line of the file:
1 5 1 3 1 5 6
1 1 2