#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int mxx = 505, nxx = 1005, INFF = 1e9 + 1;
int dp[505][505], n, m, k, ans = INFF, profit[mxx][mxx];
bool vis[mxx][mxx];
void solve() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < mxx; j++) {
      profit[i][j] = INFF;
      dp[i][j] = INFF;
    }
  for (int i = 0; i < n; i++) {
    string periods;
    cin >> periods;
    std::vector<int> v;
    for (int j = 0; j < m; j++)
      if (periods[j] == '1') v.push_back(j);
    ;
    for (int spend = 0; spend <= (int)(v.size()); spend++) {
      if (spend == (int)(v.size())) {
        profit[i][spend] = 0;
        continue;
      }
      for (int beg = 0; beg <= spend; beg++) {
        int end = spend - beg;
        profit[i][spend] =
            min(profit[i][spend], v[(int)(v.size()) - 1 - end] - v[beg] + 1);
        ;
      }
    }
    if (i == 0) {
      for (int j = 0; j < (int)(v.size()) + 1; j++) {
        dp[i][j] = profit[i][j];
        vis[i][j] = 1;
      }
      continue;
    }
    int cost = 0;
    while (cost <= (int)(v.size())) {
      for (int j = 0; j < mxx; j++) {
        if (cost > j) continue;
        if (vis[i - 1][j - cost]) {
          vis[i][j] = 1;
          dp[i][j] = min(dp[i][j], dp[i - 1][j - cost] + profit[i][cost]);
          ;
        }
      }
      cost++;
    }
  }
  for (int i = 0; i < k + 1; i++) {
    if (vis[n - 1][i]) ans = min(ans, dp[n - 1][i]);
    ;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
