program skill_up
  implicit none
  integer, parameter :: inf = 1e9
  integer :: n, m, x, c(12) = 0, a(12,12) = 0, i, j, u, ans = inf, tmp, s(12) = 0
  read(*,*) n, m, x
  do i = 1, n
    read(*,*) c(i), a(i,1:m)
  end do
  u = lshift(1,n)-1
  do j = 0, u
    tmp = 0
    s = 0
    do i = 1, n
      if (.not.btest(j,i-1)) cycle
      tmp = tmp+c(i)
      s(1:m) = s(1:m)+a(i,1:m)
    end do
    if (all(s(1:m) >= x)) ans = min(ans,tmp)
  end do
  write(*,'(i0)') merge(-1,ans,ans == inf)
end program skill_up