In the middle ages, artisans used a hourglass for measuring time. As such devices were quite rare and expensive, not every master had a set of them that made it possible to measure any time interval. Artisans were very inventive, and managed to produce very complex measurements with the help of minimum options (choice of devices). For example, with the help of 3-minute and 5-minute devices any number of minutes (greater than 4) could be calculated. And can you surpass our ancestors?
You have $$$n$$$ (up to 4) hourglasses numbered $$$1$$$, $$$2$$$, ..., $$$n$$$, the sand in which is poured during $$$t_1$$$, $$$t_2$$$, ..., $$$t_n$$$ (up to 20) minutes, respectively. Compile a program that will find a way to measure out $$$k$$$ minutes with the help of this device. Note that:
For example, let us have a device for 3 and 5-minute duration. Let's show how they can be used to measure 7 minutes:
The first line of input contains the integer $$$n$$$ ($$$1 \leq n \leq 4$$$) — the number of hourglasses. The second line contains integers $$$t_1$$$, $$$t_2$$$, ..., $$$t_n$$$ ($$$1 \leq t_1 \lt t_2 \lt \ldots \lt t_n \leq 20$$$) separated by spaces — hourglass denominations. The third line contains the integer $$$k$$$ ($$$1 \leq k \leq 1440$$$) — the time interval to be measured.
The first line of the output contains $$$-1$$$ if the time interval $$$k$$$ cannot be measured.
Otherwise, it contains an integer $$$r$$$ — the number of time moments ($$$1 \leq r \leq k$$$) at which the hourglass is turned over. This is followed by $$$r$$$ lines describing the moments of turning the clock over.
Each such line begins with the number $$$t_i$$$ — the number of minutes from the start of the countdown, up to the moment of this inversion. Next, a space is followed by the number $$$m_i$$$ ($$$0 \leq m_i \leq n$$$) — the number of hourglasses flipped at the time of $$$t_i$$$. Further, after a space, the numbers of the turned over hourglasses are specified.
The lines should be displayed in the increasing order of time: $$$t_i \gt t_{i-1}$$$. At the moment of time specified as $$$t_i$$$, at least, one hourglass should run out of sand.
The first line should contain a description of the initial time ($$$t_1=0$$$). The last line must contain the time point $$$k$$$ and 0 of the hourglasses that are being flipped. Lines with time specification $$$t_i \gt k$$$ can't be displayed. Lines with time specification $$$m_i = 0$$$ are allowed and are not considered a mistake.
2 3 5 7
4 0 2 1 2 3 1 1 5 1 1 7 0
2 3 5 4
-1
2 7 9 13
5 0 2 1 2 7 1 1 9 2 1 2 11 1 2 13 0
| Name |
|---|


