The first line of the input contains two integers, $N (1≤ N ≤1200)$ and $M (1≤ M ≤1200)$.
The following $N$ blocks of lines each describe an order; they are structured as follows: The first line of block $i$ contains two integers, the income value $v_i (1 ≤ v_i ≤ 5000)$ for order $O_i$ and the number of machines $m_i (1 ≤ m_i ≤ M)$ needed for $O_i$. The following $m_i$ lines each specify a machine $j (1 ≤ j ≤ M)$ needed to complete $O_i$ and the rent $r_{ij} (1 ≤ r_{ij} ≤ 20000)$ needed to rent this machine for this order.
The $M$ lines after the last order block contain one integer each: the purchase price $s_i (1≤ s_i ≤ 20000)$ for each machine.
