#include <bits/stdc++.h>
using namespace std;
long long int fast_expo(long long int x, long long int p) {
  if (p == 0)
    return 1;
  else if (p % 2 == 0) {
    long long int t = fast_expo(x, p / 2) % 1000000007;
    return (t * t) % 1000000007;
  } else
    return (x * (fast_expo(x, p - 1)) % 1000000007) % 1000000007;
}
long long int aft_bunk[501][501];
long long int dp[501][501];
vector<long long int> vect[501];
long long int solve(long long int day, long long int bunk) {
  if (day == -1 && bunk >= 0) return 0;
  if (day < 0 || bunk < 0) return INT_MAX;
  if (dp[day][bunk] != -1) return dp[day][bunk];
  long long int ans = INT_MAX;
  for (long long int i = 0; i <= vect[day].size(); ++i) {
    long long int temp = solve(day - 1, bunk - i) + aft_bunk[day][i];
    if (ans > temp) ans = temp;
  }
  return dp[day][bunk] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, k;
  cin >> n >> m >> k;
  char tempo;
  for (long long int i = 0; i < n; ++i) {
    for (long long int j = 1; j <= m; ++j) {
      cin >> tempo;
      if (tempo == '1') {
        vect[i].push_back(j);
      }
    }
  }
  for (long long int i = 0; i < n; ++i) {
    for (long long int j = 0; j < 501; ++j) {
      aft_bunk[i][j] = INT_MAX;
    }
  }
  long long int temp;
  for (long long int i = 0; i < n; ++i) {
    for (long long int j = 0; j < vect[i].size(); ++j) {
      long long int ptr1 = 0, ptr2 = vect[i].size() - 1 - j;
      for (long long int ptr1 = 0; ptr1 <= j; ptr1++, ptr2++) {
        temp = vect[i][ptr2] - vect[i][ptr1] + 1;
        if (temp < aft_bunk[i][j]) aft_bunk[i][j] = temp;
      }
    }
    aft_bunk[i][vect[i].size()] = 0;
  }
  for (long long int i = 0; i < 501; ++i) {
    for (long long int j = 0; j < 501; ++j) dp[i][j] = -1;
  }
  cout << solve(n - 1, k);
  return 0;
}
