N,M,X = map(int,input().split()) 
C = [list(map(int,input().split())) for i in range(N)]
A = [0]

for i in range(2**M):
    f = True
    cost = 0
    a = [0]*M
    op = []
    



if X <= min(A):
    print(A[0])
else:
    print("-1")
