      PROGRAM skillUp
      IMPLICIT NONE
      integer(16) :: n,m,x
      integer(16),allocatable :: c(:),a(:,:),su(:)
      integer(16) :: i,k,ans
      logical,allocatable :: flag(:)
      logical :: piyo = .false.
      
      read*,n,m,x
      allocate( c(n), a(n,m),flag(n),su(m) )
      do i = 1,n
        read*,c(i),a(i,1:m)
      end do
      
      ans = sum( c )
      
      outer:do i = 1,2**n-1
        do k = 1,n
          flag(k) = btest( i,k-1 )
        end do
  !      print*,flag
        
        do k = 1,m
          su(k) = sum( a(:,k),flag )
        end do
        !print*,su
        do k = 1,m
          if( su(k)<x )then
            cycle outer
          end if
        end do
        
        piyo = .true.
        ans = min( ans,sum( c,flag ) )
        
      end do outer
      
      if( piyo )then
        print*,ans
      else
        print*,'-1'
      end if
      
      
  !    print*,n,m,x
  !    do i = 1,n
  !      print*,c(i),a(i,1:m)
  !    end do
      
      END PROGRAM