#include using namespace std; #define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i) #define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i > 0; i--) #define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i) #define FOR(e, c) for (auto &e : c) #define SORT(v, n) sort(v, v + n); #define vsort(v) sort(v.begin(), v.end()); #define rvisort(v) sort(v.begin(), v.end(), greater()); #define all(v) v.begin(), v.end() #define mp(n, m) make_pair(n, m); #define cout(d) cout<; using vvi = vector; using vll = vector; using vvll = vector; using pii = pair; using ul = unsigned long; const int MOD = 1e9+7; const int INF = 1e9; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int GCD(int a, int b) { return b ? GCD(b, a%b) : a; } int LCM(int a, int b) { return a * b / GCD(a, b); } signed main() { int n,m,K; cin>>n>>m>>K; vvi A(n,vi(m)); rep(i,n) rep(j,m) cin>>A[i][j]; vi dp(K+1,0); dp[0]=1; rep(i,n){ vi tmp(K+1,0); rep(j,m){ for(int k=0; k+A[i][j]<=K; k++){ if(dp[k]) tmp[k+A[i][j]]=1; // 自国のお土産を買ってtrueになったk円を分けるためにtmpに保存 } dp=tmp; } } for(int i=K; i>=0; i--){ if(dp[i]){ cout<