#include<stdio.h>

typedef struct book {
	int price;
	int a[12];
} Book;

void sort_by_price(Book *ptr, int num);
void sort_by_n(Book *ptr, int sort, int num);

int main(void) {
	int n, m, x, flag = 0, totalprice = 0, totalmax = -1;
	Book books[12];
	int understand[12];
	for (int i; i < 12; i++) {
		understand[i] = 0;
	}

	scanf("%d %d %d", &n, &m, &x);

	for (int i = 0; i < n; ++i) {
		scanf("%d", &books[i].price);
		for (int j = 0; j < m; ++j) {
			scanf("%d", &books[i].a[j]);
		}
	}

	for (int r = 0; r < m; ++r) {
		sort_by_n(books, r, n);
		totalprice = 0;
		for (int f = 0; f < 12; f++) {
			understand[f] = 0;
		}

		for (int i = 0; i < n; ++i) {
			totalprice += books[i].price;
			for (int j = 0; j < m; ++j) {	//加算
				understand[j] += books[i].a[j];
			}
			for (int k = 0; k < m; ++k) {	//評価
				if (understand[k] < x) {
					flag = 0;
					break;
				}
				flag = 1;
			}
			if (flag == 1) {				//分岐
				break;
			}
		}

		if (flag == 1) {
			if (totalmax == -1 || totalmax > totalprice) {
				totalmax = totalprice;
			}
		}

	}

	printf("%d", totalmax);

	return 0;
}

void sort_by_price(Book *ptr, int num) {
	Book temp;
	for (int i = 0; i < num - 1; ++i) {
		for (int j = num - 1; j > i; j--) {
			if ((*(ptr + j - 1)).price > (*(ptr + j)).price) {
				temp = (*(ptr + j - 1));
				(*(ptr + j - 1)) = (*(ptr + j));
				(*(ptr + j)) = temp;
			}
		}
	}
}

void sort_by_n(Book *ptr, int sort, int num) {
	Book temp;
	for (int i = 0; i < num - 1; ++i) {
		for (int j = num - 1; j > i; j--) {
			if ((*(ptr + j - 1)).a[sort] > (*(ptr + j)).a[sort]) {
				temp = (*(ptr + j - 1));
				(*(ptr + j - 1)) = (*(ptr + j));
				(*(ptr + j)) = temp;
			}
		}
	}
}
