#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, siz = 5e2 + 5;
int t, n, m, k, a[siz], skp[siz][siz], dp[siz][siz];
char s[siz][siz];
vector<int> ones[siz];
int go(int day, int skips) {
  if (day > n) return 0;
  if (dp[day][skips] != -1) return dp[day][skips];
  int ret = 1e9, sz = ones[day].size();
  if (sz == 0) return dp[day][skips] = go(day + 1, skips);
  int lim = min(skips, sz);
  for (int i = 0; i <= lim; i++) {
    ret = min(ret, skp[day][i] + go(day + 1, skips - i));
  }
  return dp[day][skips] = ret;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> s[i][j];
    for (int j = 1; j <= m; j++)
      if (s[i][j] == '1') ones[i].push_back(j);
    for (int j = 0; j <= 500; j++) skp[i][j] = 1e9;
    if (ones[i].size() == 0) continue;
    skp[i][ones[i].size()] = 0;
    skp[i][0] = ones[i].back() - ones[i][0] + 1;
    for (int take = 1; take < ones[i].size(); take++) {
      for (int j = 0; j + take - 1 < ones[i].size(); j++) {
        int time_wasted = ones[i][j + take - 1] - ones[i][j] + 1;
        int skps = ones[i].size() - take;
        skp[i][skps] = min(skp[i][skps], time_wasted);
      }
    }
  }
  memset(dp, -1, sizeof dp);
  cout << go(1, k) << endl;
}
