#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1e9;
int dp1[510][510];
vector<vector<int> > best_options;
void solve(int index, string &s) {
  int len = s.size();
  s = "x" + s;
  for (int i = 1; i <= len; i++) {
    for (int j = 1; j <= len; j++) {
      dp1[i][j] = inf_int;
    }
  }
  int acum = 0;
  int prev = -1;
  for (int i = 1; i <= len; i++) {
    if (s[i] == '1') {
      acum++;
      dp1[i][1] = 1;
      if (acum == 1) {
        prev = i;
        continue;
      }
      int dist = i - prev;
      for (int j = 2; j <= acum; j++) {
        dp1[i][j] = dist + dp1[prev][j - 1];
      }
      prev = i;
    }
  }
  best_options[index].push_back(0);
  if (acum) best_options[index].push_back(1);
  for (int i = 2; i <= acum; i++) {
    int best = inf_int;
    for (int j = i; j <= len; j++) {
      best = min(best, dp1[j][i]);
    }
    best_options[index].push_back(best);
  }
}
bool memo[510][510];
int dp[510][510];
int min_hours(int n, int k) {
  if (n == 0) return 0;
  if (memo[n][k]) return dp[n][k];
  memo[n][k] = true;
  int total_hours = best_options[n].size() - 1;
  int ans = inf_int;
  for (int i = best_options[n].size() - 1; i >= 0; i--) {
    int diff = total_hours - i;
    if (k < diff) break;
    int opt = min_hours(n - 1, k - diff) + best_options[n][i];
    ans = min(ans, opt);
  }
  return dp[n][k] = ans;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  string s;
  int n, m, k;
  cin >> n >> m >> k;
  best_options.assign(n + 1, vector<int>());
  for (int i = 1; i <= n; i++) {
    cin >> s;
    solve(i, s);
  }
  cout << min_hours(n, k) << "\n";
}
