program ABC167C
    implicit none
    integer(8)::N,M,X,i,j,ans,csum,k
    character(16)::b
    integer(8),allocatable,dimension(:)::C,P
    integer(8),allocatable,dimension(:,:)::A
    read*,N,M,X
    allocate(C(N))
    allocate(P(M))
    allocate(A(M,N))
    do i=1,N
        read(5,*)C(i),(A(j,i),j=1,M)
    end do
    ans=10**9

    do i=1,2**N
        P=0
        csum=0
        write(b,'(b16.16)')i
        !print'(A)',b
        do j=0,N-1
            if(b(16-j:16-j)=="1")then
                csum=csum+C(j+1)
                do k=1,M
                    P(k)=P(k)+A(k,j+1)
                end do
            end if
        end do
        if(minval(P)>=X)ans=min(ans,csum)
    end do
    if(ans==10**9)ans=-1
    print'(i0)',ans
end program ABC167C