#include <bits/stdc++.h>
using namespace std;
int n, m, k, mmm = 0;
int dp[600][600];
string a;
int ukupno = 0;
int maxn[600];
vector<int> temp;
vector<int> ans;
vector<int> pocetak;
vector<int> kraj;
int Optimal(vector<int> &st, vector<int> &en, int br) {
  int p = 0;
  int mm = 0;
  if (br == st.size() - 1) return st[br];
  while (br - p > 0) {
    mm = max(st[br - p] + en[p], mm);
    mm = max(en[br - p] + st[p], mm);
    p++;
  }
  return mm;
}
void Dinamik(int ii, int br, int ovo) {
  int p = 0;
  while (br + p <= k) {
    dp[ii][br + p] = max(dp[ii][br + p], dp[ii - 1][p] + ovo);
    dp[ii][br + p] = max(dp[ii - 1][br + p], dp[ii][br + p]);
    dp[ii][br + p] = max(dp[ii][br + p], dp[ii][br + p - 1]);
    if (dp[ii][br + p] > mmm) mmm = dp[ii][br + p];
    p++;
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    for (int j = 0; j < m; j++) {
      if (a[j] == '1') {
        temp.push_back(j);
      }
    }
    if (temp.size() != 0) {
      for (int l = 1; l < temp.size(); l++)
        pocetak.push_back(temp[l] - temp[0]);
      pocetak.push_back(temp[temp.size() - 1] - temp[0] + 1);
      for (int l = temp.size() - 2; l >= 0; l--)
        kraj.push_back(temp[temp.size() - 1] - temp[l]);
      kraj.push_back(temp[temp.size() - 1] - temp[0] + 1);
      maxn[i] = temp[temp.size() - 1] - temp[0] + 1;
      ukupno += maxn[i];
      kraj.insert(kraj.begin(), 0);
      pocetak.insert(pocetak.begin(), 0);
      temp.clear();
      for (int l = 0; l < kraj.size() - 1; l++)
        temp.push_back(Optimal(pocetak, kraj, l + 1));
      for (int l = 0; l < temp.size(); l++) Dinamik(i, l + 1, temp[l]);
      pocetak.clear();
      kraj.clear();
      temp.clear();
    } else
      Dinamik(i, 1, 0);
  }
  cout << ukupno - mmm;
  return 0;
}
