#include <bits/stdc++.h>
using namespace std;
void setIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long double PI = 4 * atan((long double)1);
const int INF = 1e9 + 7;
const int mxn = 507;
int dp[mxn][mxn], at[mxn][mxn], c[mxn];
int main() {
  setIO();
  for (int i = 1; i < mxn; i++)
    for (int j = 0; j < mxn; j++) dp[i][j] = at[i][j] = INF;
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    vector<int> vi;
    int bef = 0;
    bool ok = false;
    string s;
    cin >> s;
    for (int j = 0; j < (int)s.size(); j++) {
      if (s[j] == '1') {
        c[i]++;
        if (!ok)
          ok |= 1;
        else
          vi.push_back(j - bef + 1);
        bef = j;
      }
    }
    for (int j = 1; j < (int)vi.size(); j++) vi[j] += vi[j - 1];
    at[i][0] = 0;
    at[i][1] = 1;
    for (int j = 2; j <= m; j++) {
      for (int l = 0; l + j - 1 <= (int)vi.size(); l++)
        at[i][j] =
            min(at[i][j], vi[l + j - 2] - (l > 0 ? vi[l - 1] : 0) - j + 2);
      if (at[i][j] == INF) at[i][j] = at[i][j - 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int p = 0; p <= c[i] && p <= j; p++) {
        dp[i][j] = min(dp[i][j], at[i][c[i] - p] + dp[i - 1][j - p]);
      }
    }
  }
  cout << dp[n][k] << endl;
}
