#include <bits/stdc++.h>
using namespace std;
long long int skip_classes[501][501], dp[501][501], N, M, K;
vector<int> timings[501];
vector<string> grid(501);
void preprocess() {
  for (long long int i = 1; i <= N; i++) {
    int total_classes_on_day_i = timings[i].size();
    for (int skip = 0; skip <= K; skip++) {
      skip_classes[i][skip] = INT_MAX;
      int to_attend = total_classes_on_day_i - skip;
      if (to_attend <= 0)
        skip_classes[i][skip] = 0;
      else
        for (int j = to_attend - 1; j < timings[i].size(); j++) {
          skip_classes[i][skip] =
              (skip_classes[i][skip] <=
                       timings[i][j] - timings[i][j - to_attend + 1] + 1
                   ? skip_classes[i][skip]
                   : timings[i][j] - timings[i][j - to_attend + 1] + 1);
        }
    }
  }
  return;
}
long long int solve_for(long long int day, long long int can_skip) {
  if (can_skip < 0) return INT_MAX;
  if (day == 0) return 0;
  if (dp[day][can_skip] != -1) return dp[day][can_skip];
  long long int ans = INT_MAX, current_ans;
  for (long long int i = 0; i <= can_skip; i++) {
    current_ans = solve_for(day - 1, can_skip - i) + skip_classes[day][i];
    ans = (ans <= current_ans ? ans : current_ans);
  }
  return dp[day][can_skip] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  cin >> N >> M >> K;
  for (long long int i = 1; i <= N; i++) {
    cin >> grid[i];
    for (int j = 0; j < grid[i].size(); j++) {
      if (grid[i][j] == '1') timings[i].push_back(j + 1);
    }
  }
  preprocess();
  long long int ans = solve_for(N, K);
  cout << ans << endl;
  return 0;
}
