#include <bits/stdc++.h>
using namespace std;
int n, m, t;
string a[510];
int iWeekJClasses[510][510];
int total[510];
int dp[510][510];
int minHours(int week, int classes) {
  int minHrs = 300010;
  int last = 0;
  int cnt = 0;
  int j = 0;
  while (j < m && a[week][j] != '1') ++j;
  for (int i = (j); i < (m); ++i) {
    cnt += (a[week][i] == '1') ? 1 : 0;
    if (cnt == classes) {
      minHrs = min(minHrs, i - j + 1);
      ++j;
      while (j < m && a[week][j] != '1') ++j;
      cnt--;
    }
  }
  return minHrs;
}
int main() {
  cin >> n >> m >> t;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  for (int i = (0); i < (n); ++i) {
    iWeekJClasses[i][0] = 0;
    for (int j = (1); j < (m + 1); ++j) {
      iWeekJClasses[i][j] = minHours(i, j);
    }
  }
  for (int i = (0); i < (n); ++i) {
    int counter = 0;
    for (int j = (0); j < (m); ++j) {
      counter += (a[i][j] == '1') ? 1 : 0;
    }
    total[i] = counter;
  }
  for (int j = (0); j < (t + 1); ++j) {
    dp[0][j] = iWeekJClasses[0][total[0] - j];
  }
  for (int i = (1); i < (n); ++i) {
    for (int j = (0); j < (t + 1); ++j) {
      dp[i][j] = INT_MAX;
      for (int k = (0); k < (j + 1); ++k) {
        dp[i][j] =
            min(dp[i][j], dp[i - 1][k] + iWeekJClasses[i][total[i] - (j - k)]);
      }
    }
  }
  int ans = INT_MAX;
  for (int j = (0); j < (t + 1); ++j) {
    ans = min(ans, dp[n - 1][j]);
  }
  cout << ans << endl;
  return 0;
}
