program main
integer*8 :: n, m, x,ans=10000000,cost=0
integer*8,allocatable :: c(:),r(:),a(:,:)

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

do i = 0,2**n-1
r(:) = 0
cost = 0
do j = 0,n-1

if (btest(i,j)) then
do k = 1,m
r(k) = r(k) + a(j,k)
end do
cost = cost + c(j)
end if

if(minval(r) >= x) ans = min(cost,ans)
end do
end do

if (ans == 1000000) then
write(*,*)-1
else
write(*,*)ans
end if
end program main