Kitamasa's Counterattack

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

There are nn boxes (numbered 11 through nn), mm keys (numbered 11 through mm), and dd shops (numbered 11 through dd). The key ii can be used to open one of the boxes a_i,1,,a_i,k_ia\_{i,1}, \ldots, a\_{i,k\_i}. However, once a key is used to open a box, it disappears. Thus, a key can't be used to open multiple boxes. The key ii is sold at the shop s_is\_i, and its price is c_ic\_i dollars. Akiba wants to buy some keys and open all the boxes. (He can't buy the same key multiple times.)

Kitamasa wants to prevent Akiba from doing this. In order to do it, he can change the prices of some keys before Akiba decides which keys to buy. If he pays b_jb\_j dollars, he can increase the prices of all keys sold at the shop jj by one dollar. For each shop, he can repeat this any non-negative integer number of times: for example, if he pays 2b_j2 b\_j dollars, he can increase the prices of all keys sold at the shop jj by two dollars. However, for example when b_j=2b\_j = 2, he can't pay 11 dollar and change the prices by 0.50.5 dollars.

Akiba's objective is to minimize the value (Akiba's payment) - (Kitamasa's payment), and Kitamasa's objective is to maximize it. Compute this value when the two players play optimally. If the answer can be infinitely large, print 1-1. It is guaranteed that if Kitamasa does nothing, Akiba can open all boxes.

입력

The first line of input contains three integers nn, mm, and dd (1m10001 \le m \le 1000, n100n \le 100, 1n,dm1 \le n, d \le m).

Then mm lines follow, each describing one key. Each line starts with three integers: c_ic\_i, the price of the key, s_is\_i, the number of the shop where the key is sold, and k_ik\_i, the number of boxes this key can open. Then k_ik\_i integers follow: the numbers of these boxes (1c_i10001 \le c\_i \le 1000, 1s_id1 \le s\_i \le d, 1k_imin(10,n)1 \le k\_i \le \min (10, n), 1a_i,jn1 \le a\_{i,j} \le n, and if jkj \ne k, a_i,ja_i,ka\_{i,j} \ne a\_{i,k}).

Then dd lines follow, each containing one integer b_ib\_i (1b_i10001 \le b\_i \le 1000).

출력

Print one integer: the answer to the problem.