N,M,K = map(int,input().split()) lsA = [list(map(int,input().split())) for i in range(N)] dp = [False]*(K+1) dp[0] = True for i in range(N): dp2 = [False]*(K+1) for j in range(M): for k in range(K+1): if k - lsA[i][j] >= 0: dp2[k] = dp[k-lsA[i][j]]|dp2[k] dp = dp2 cost = K+1 for i in range(K+1): if dp[i]: cost = i print(K-cost)