In the first line of the standard input an integer k(3<=k<=50)is given, which is the number of different colours of sticks. The colours themselves are numbered from 1 to k.
The following klines contain descriptions of the sticks of particular colours. The line no. i+1holds integers that describe the sticks of colour , separated by single spaces. The first of these numbers, Ni(1<=Ni<=10^6) denotes the number of sticks of colour . It is followed, in the same line, by Niintegers denoting the lengths of the sticks of colour . All lengths are positive and do not exceed10^9. Furthermore, the total number of all sticks does not exceed 10^6.0020
In tests worth at least 30% of the points the following holds in addition: the total number of the sticks does not exceed 250.