#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long N = 5e2 + 2;
long long dp[N][N];
long long mn[N][N];
vector<long long> g[N];
long long n, m, k;
void pre() {
  for (long long i = 0; i < n; i++) {
    long long ones = ((long long)(g[i]).size());
    for (long long j = 0; j < ones; j++) {
      for (long long jj = j; jj < ones; jj++) {
        long long t = g[i][jj] - g[i][j] + 1;
        long long d = jj - j + 1;
        mn[i][d] = min(mn[i][d], t);
      }
    }
  }
}
long long dfs(long long i, long long d) {
  if (d < 0) return INF;
  if (i == n) return 0;
  long long& ans = dp[i][d];
  if (ans + 1) return ans;
  ans = INF;
  if (!((long long)(g[i]).size()))
    ans = min(ans, dfs(i + 1, d));
  else {
    ans = min(ans, g[i].back() - g[i].front() + 1 + dfs(i + 1, d));
    long long tot = ((long long)(g[i]).size());
    if (d >= tot) ans = min(ans, dfs(i + 1, d - tot));
    for (long long skip = 1; skip <= tot; skip++) {
      long long attend = tot - skip;
      ans = min(ans, mn[i][attend] + dfs(i + 1, d - skip));
    }
  }
  return ans;
}
void solve() {
  cin >> n >> m >> k;
  for (long long i = 0; i < (n); i++) {
    string s;
    cin >> s;
    for (long long j = 0; j < (m); j++)
      if (s[j] == '1') g[i].push_back(j);
  }
  memset(mn, (long long)(0x3f), sizeof(mn));
  pre();
  memset(dp, (long long)(-1), sizeof(dp));
  cout << dfs(0, k) << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
