Imports System

Module Program
    Sub Main(args As String())

        Dim NMX() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()
        Dim tbl(NMX(0), NMX(1)) As Integer
        For i As Integer = 1 To NMX(0)
            Dim tmp() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()
            For j = 0 To NMX(1)
                tbl(i, j) = tmp(j)
            Next
        Next

        Dim ans As Integer = Integer.MaxValue
        For i = 1 To 2 ^ NMX(0)
            Dim kingaku As Integer = CheckBooks(NMX, tbl, i)
            If kingaku < ans Then
                ans = kingaku
            End If
        Next

        If ans = Integer.MaxValue Then ans = -1

        Console.WriteLine(ans)

    End Sub

    Private Function CheckBooks(NMX() As Integer, tbl(,) As Integer, ptn As Integer) As Integer

        CheckBooks = Integer.MaxValue
        Dim rikaido(NMX(1)) As Integer
        Dim tassei As New List(Of Integer)
        Dim gokei As Integer

        For i As Integer = 1 To NMX(0)
            If ptn \ (2 ^ (i - 1)) Mod 2 = 1 Then
                For j As Integer = 1 To NMX(1)
                    rikaido(j) += tbl(i, j)
                    If rikaido(j) >= NMX(2) Then
                        If Not tassei.Contains(j) Then
                            tassei.Add(j)
                        End If
                    End If
                Next
                gokei += tbl(i, 0)
            End If
        Next

        If tassei.Count = NMX(1) Then
            CheckBooks = gokei
        End If

    End Function

End Module
