#include <bits/stdc++.h>
using namespace std;
string s;
vector<long int> inp[505];
long int n, m, k, dp[505][505], act[505][505];
long int twfek(long int i, long int kl) {
  long int ans = 1000005, o = inp[i].size();
  long int limm = min(o, kl);
  if (i >= n) {
    return 0;
  }
  if (act[i][kl] != -1) return act[i][kl];
  if (inp[i].size() == 0) {
    return twfek(i + 1, kl);
  }
  if (kl == 0) {
    int ri = inp[i].size() - 1;
    return twfek(i + 1, kl) + (inp[i][ri] - inp[i][0] + 1);
  }
  for (int y = limm; y >= 0; y--) {
    ans = min(twfek(i + 1, kl - y) + dp[i][y], ans);
  }
  return act[i][kl] = ans;
}
int main() {
  for (int i = 0; i < 502; i++)
    for (int j = 0; j < 502; j++) {
      dp[i][j] = -1;
      act[i][j] = -1;
    }
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '1') inp[i].push_back(j);
    }
  }
  for (int i = 0; i < n; i++) {
    long int pp = inp[i].size();
    long int limm = min(pp, k);
    for (int y = limm; y >= 0; y--) {
      if (y == pp)
        dp[i][y] = 0;
      else if (y == 0)
        dp[i][y] = inp[i][pp - 1] - inp[i][0] + 1;
      else {
        long int lef, ri = 0, b = 1000005;
        lef = y;
        while (lef >= 0) {
          b = min(b, inp[i][pp - ri - 1] - inp[i][lef] + 1);
          lef--;
          ri++;
        }
        dp[i][y] = b;
      }
    }
  }
  cout << twfek(0, k);
  return 0;
}
