#include using namespace std; typedef long long ll; #define pb push_back #define fi first #define se second typedef pair P; using VP = vector

; using VVP = vector; using VI = vector; using VVI = vector; using VVVI = vector; const int inf=1e9+7; const ll INF=1LL<<58; const ll Mod=998244353; int main(){ int i,j; int n,m,k; cin>>n>>m>>k; int a[n][m]; for(i=0;i>a[i][j]; } VVI cm(n,VI(505,0)); for(i=0;i=0&&cm[i-1][l-a[i][j]]==1) cm[i][l]=1; } } } int ans=-1; for(i=1;i<=k;i++){ if(cm[n-1][i]==1) ans=i; } if(ans==-1) cout<<-1<