#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;
typedef long double ld;
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define N 200010

int main() {
	int n, m, x, c[20] = { 0 }, a[20][20];
	rep(i, 19) {
		rep(j, 19) {
			a[i][j] = 0;
		}
	}
	scanf("%d %d %d", &n, &m, &x);
	Rep(i,1,n+1) {
		scanf("%d", &c[i]);
		Rep(j, 1, m+1)scanf("%d", &a[i][j]);
	}

	Rep(i, 1, n + 1) {
		int sum = 0;
		Rep(j, 1, m + 1) {
			sum += a[i][j];
		}
		if (sum < x) { printf("-1"); return 0; }
	}
}