int n,m,t; int col[maxn][maxm]; int dp[maxn][maxm][maxm][2],tdp[maxt];
int main() { read(n),read(m),read(t); for(register int i=1;i<=n;++i) { char c[maxm]; scanf("%s",c+1); for(register int j=1;j<=m;++j) col[i][j]=c[j]-'0'; } for(register int li=1;li<=n;++li) for(register int i=1;i<=m;++i) for(register int k=1;k<=min(t,m);++k) for(register int x=0;x<=1;++x) dp[li][i][k][x]=max(dp[li][i-1][k][x],dp[li][i-1][k-1][x^1])+(x==col[li][i]); for(register int i=1;i<=n;++i) for(register int j=t;j>=0;--j) for(register int k=1;k<=min(j,m);++k) tdp[j]=max(tdp[j],tdp[j-k]+max(dp[i][m][k][0],dp[i][m][k][1])); printf("%d",tdp[t]); return 0; }