n,m,k = map(int,input().split()) A = [list(map(int,input().split())) for i in range(n)] dp = [0]*(k+1) dp[k] = 1 for a in A: ndp = [0]*(k+1) for i in range(k+1): if dp[i] == 0: continue for j in a: if i-j >= 0: ndp[i-j] = 1 dp = ndp for i in range(k+1): if dp[i]: print(i) exit() print(-1)