#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000000;
string s;
int n, m, k, ans = MAX, f[505][505], d[505][505], len[505];
void calc(int x) {
  vector<int> a;
  a.clear();
  for (int i = 0; i < m; ++i) {
    if (s[i] == '1') a.push_back(i);
  }
  len[x] = a.size();
  int l = 0, r = a.size() - 1;
  for (int i = 0; i < len[x]; ++i) {
    f[x][i] = MAX;
    for (int j = 0; j <= i; ++j) {
      f[x][i] = min(f[x][i], a[len[x] - 1 - j] - a[i - j] + 1);
    }
  }
}
int main() {
  scanf("%d%d%d\n", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    getline(cin, s);
    calc(i);
  }
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) d[i][j] = MAX;
    sum += len[i];
    for (int j = 0; j <= min(sum, k); ++j) {
      for (int u = 0; u <= min(j, len[i]); ++u) {
        d[i][j] = min(d[i][j], d[i - 1][j - u] + f[i][u]);
      }
    }
  }
  for (int i = 0; i <= k; ++i) ans = min(ans, d[n][i]);
  cout << ans;
  return 0;
}
