#include int ri() { int n; scanf("%d", &n); return n; } int main() { int n = ri(), m = ri(), k = ri(); bool dp[k + 1]; memset(dp, 0, sizeof(dp)); dp[k] = true; for (int i = 0; i < n; i++) { bool next[k + 1]; memset(next, 0, sizeof(next)); int a[m]; for (int j = 0; j < m; j++) a[j] = ri(); for (int j = 0; j < m; j++) for (int l = a[j]; l <= k; l++) if (dp[l]) next[l - a[j]] = true; memcpy(dp, next, sizeof(dp)); } int res = -1; for (int i = 0; i <= k; i++) { if (dp[i]) { res = i; break; } } std::cout << res << std::endl; return 0; }