program main
      implicit none
      integer :: n, m, x
      integer, allocatable :: c(:), a(:,:), d(:)
      integer :: i, j, k, cnt
      integer(8) :: minprice, price

      read *, n, m, x
      allocate( c(n) )
      allocate( a(n,m) )
      do i = 1, n
        read *, c(i), a(i,:)
      end do

      allocate( d(m) ) 
      minprice = 10**9
      do i = 0, (2**n-1)
        d(:) = 0
        price = 0
        do j = 1, n
          if( btest(i,j-1) ) then
            do k = 1, m
              d(k) = d(k) + a(j,k)
            end do
            price = price + c(j)
          end if
        end do
        cnt = 0
        do k = 1, m
          if ( d(k) >= x ) then
            cnt = cnt + 1
          else
            exit
          end if
        end do
        if ( cnt == m ) then
          if ( minprice > price ) then
            minprice = price
          end if
        end if
      end do

      if ( minprice < 10**9 ) then
        print *, minprice
      else
        print *, '-1'
      end if

end program main
