Structure BOOK
    Public buy As Boolean
    Public price As Long
    Public skill As List(Of Long)
End Structure

Module Module1

    Sub main()

        Dim user2 As List(Of String) = New List(Of String)(Split(Console.ReadLine(), " "))
        Dim books As New List(Of BOOK)
        Dim countBook As Long = user2(0)
        Dim countSkill As Long = user2(1)
        Dim countRikai As Long = user2(2)

        For i = 0 To countBook - 1
            Dim user3 As List(Of String) = New List(Of String)(Split(Console.ReadLine(), " "))
            Dim book As BOOK
            book.buy = False
            book.price = CLng(user3(0))
            user3.RemoveAt(0)

            Dim a = Array.ConvertAll(user3.ToArray, Function(k As String) CLng(k))
            book.skill = New List(Of Long)(a)

            books.Add(book)
        Next

        Dim masterPrice As Long = -1

        For i = 1 To 2 ^ countBook - 1
            Dim stepBit As Long = 1
            Dim sumPrice As Long = 0
            Dim flgMaster As Boolean = True
            Dim exp(countBook) As Long

            ' 全てのスキル経験値を加算
            For k = 0 To countBook - 1                
                If stepBit = (i And stepBit) Then
                    For j = 0 To countSkill - 1
                        exp(j) += books(k).skill(j)
                    Next
                    sumPrice += books(k).price
                End If
                stepBit *= 2
            Next

            ' 目標値に達したか
            For j = 0 To countSkill - 1
                If exp(j) < countRikai Then                    
                    flgMaster = False
                    Exit For
                End If
            Next

            If flgMaster Then
                If (masterPrice > sumPrice Or masterPrice <= -1) Then
                    masterPrice = sumPrice
                End If
            End If
        Next

        Console.WriteLine(masterPrice)
    End Sub
end module