program main
  integer :: N, M
  integer :: X
  integer,allocatable :: C(:), A(:, :)
  integer :: i,j
  integer :: out,tmp
  read(*,*) N, M, X
  allocate(C(N))
  allocate(A(N, M))
  do i = 1, N
     read(*,*) C(i), A(i, :)
  end do
  if (all(sum(A(:,:), dim = 1) >= X)) then
     out = sum(C)
     block
       logical:: switch(n)
       integer:: test(M)
        do i=0,2**n-1
            do j=1,n
                switch(j) = btest(i,j-1)
             end do
             do j = 1,N
                test(j) = sum(A(:,j), mask=switch)
             end do
             if ( all(test >= X) ) then
                tmp = sum(C(:), mask=switch)
                if (tmp < out) then
                   out = tmp
                end if
             end if
        end do
      end block
      write(*,'(i0)') out
  else
     write(*,'(i0)') -1
  end if
contains

  
end program main