program cm
   implicit none
   integer::N,M,X
   integer,allocatable,dimension(:)::C
   integer,allocatable,dimension(:,:)::A
   integer,allocatable,dimension(:)::R
   integer::ans=10**9

   integer::i
   read*,N,M,X
   allocate(C(N),A(N,M))
   do i=1,N
      read*,C(i),A(i,:)
   end do

   allocate(R(M))
   do i=0,2**N-1
      call Rcheck(i)
      if(minval(R)>=X)then
         ans=min(ans,calc(i))
      endif
   end do
   print"(i0)",merge(-1,ans,ans==10**9)

contains
subroutine Rcheck(k)
   integer::k
   integer::i,j
   R=0
   do i=1,N
      if(btest(k,i-1))then
         do j=1,M
            R(j)=R(j)+A(i,j)
         end do
      endif
   end do
end subroutine
integer function calc(k)
   integer::k
   integer::i
   calc=0
   do i=1,N
      if(btest(k,i-1))then
         calc=calc+C(i)
      endif
   end do
end function
end program cm