시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB133423230.769%

문제

Although we imagine interplanetary probes to be very sophisticated pieces of technology, their information systems are quite archaic. You might assume that they have a certain amount of contiguous main memory and can store their data wherever is convenient, but unfortunately that is not the case. The probe’s main memory is organised in a number of FIFO (first-in-first-out) queues. In such a queue, data has to be taken out of the queue in the same order as it has been added to it.

A probe has multiple sensors and each sensor is linked to one of the queues. Whenever a sensor finishes recording, it appends the generated data to its queue. A sensor can write data to the queue only if the queue has enough space left to take all the data; if not, the data is lost.

In order to transfer data from the probe to Earth (in a process called downlinking), the path between the satellite and Earth must not be blocked by anything (e.g. a planet like Jupiter) and the antenna must be correctly positioned. During each downlink opportunity, data can be taken from multiple queues and transmitted back to Earth. The total amount of data that can be transmitted during a downlink opportunity depends on the length of the downlink opportunity and distance to Earth. Sensors do not collect data during downlink opportunities, since all electricity available is devoted to the transmitter.

\The most important thing for scientists is not to lose any data recorded by sensors. In particular, all queues have to be empty after the last downlink opportunity. The scientists have asked you to write a program to determine whether all data can be transferred to Earth in a given time frame.

입력

  • one line containing three positive integers n, q, s (1 ≤ n, q ≤ 30, 1 ≤ s ≤ 100), the number of downlink windows, FIFO queues, and sensors, respectively.
  • one line with s integers q1 . . . qs (1 ≤ qi ≤ q for each i), determining for each sensor the queue it feeds its data into.
  • one line with q integers c1 . . . cq (1 ≤ ci ≤ 106 for each i), determining for each queue the size of the queue in megabytes.
  • n lines, each describing one downlink window. Each contains s + 1 non-negative integers.
    • The first integer d (1 ≤ d ≤ 106 ) states the number of megabytes that can be transferred to earth during the window.
    • The following s numbers a1 . . . as (0 ≤ ai ≤ 106 for each i) describing the amount of data (in megabytes) generated by each of the sensors after the last but before this downlink window.

There will never be new data during a downlink window.

출력

Output “possible” if it is possible to transfer all data to Earth, and “impossible” otherwise.

예제 입력 1

2 2 2
1 2
3 3
5 2 2
5 2 2

예제 출력 1

possible

예제 입력 2

2 2 2
1 2
3 3
1 2 2
5 2 2

예제 출력 2

impossible