#include <bits/stdc++.h>
using namespace std;
int aa[1001][1001], bb[1001][1001];
vector<int> cc[501];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i <= 1000; i++) {
    for (int j = 0; j <= 1000; j++) {
      aa[i][j] = bb[i][j] = 2000000000;
    }
  }
  int n, m, l;
  cin >> n >> m >> l;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '1') cc[i].push_back(j);
    }
    for (int j = 0; j < cc[i].size(); j++) {
      for (int k = 0; k < cc[i].size(); k++) {
        if (j + k > cc[i].size()) continue;
        int w = cc[i][cc[i].size() - 1 - k] - cc[i][j] + 1;
        if (aa[i][j + k] > w) aa[i][j + k] = w;
      }
    }
    aa[i][cc[i].size()] = 0;
  }
  for (int i = 0; i <= l; i++) {
    bb[0][i] = aa[0][i];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= l; j++) {
      for (int k = 0; k <= cc[i].size(); k++) {
        int w = bb[i - 1][j] + aa[i][k];
        if (bb[i][j + k] > w) bb[i][j + k] = w;
      }
    }
  }
  int ret = 2000000000;
  for (int i = 0; i <= l; i++)
    if (ret > bb[n - 1][i]) ret = bb[n - 1][i];
  cout << ret;
  return 0;
}
