#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int r = 1;
  x = x % p;
  while (y) {
    if (y & 1) r = r * x % p;
    y = y >> 1;
    x = x * x % p;
  }
  return r;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l = 0, int r = 1e9) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}
const int N = 505;
int n, m, k;
int dp[N][N];
int arr[N][N];
int pres[N];
int num[N][N];
long long int solve(int id, int k) {
  if (id == n) return 0;
  if (k < 0) return 1e9;
  if (dp[id][k] != -1) return dp[id][k];
  long long int ans = 1e9;
  for (int i = 0; i <= min(k, pres[id]); i++)
    ans = min(ans, num[id][pres[id] - i] + solve(id + 1, k - i));
  return dp[id][k] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  memset(dp, -1, sizeof(dp));
  char ch;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      cin >> ch, arr[i][j] = (ch == '1'), num[i][j] = 1e9;
  for (int i = 0; i < n; i++) num[i][0] = 0, num[i][m] = 1e9;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) pres[i] += arr[i][j];
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == 0) continue;
      int cnt = 0;
      for (int k = j; k < m; k++) {
        if (arr[i][k] == 1) cnt++, num[i][cnt] = min(num[i][cnt], k - j + 1);
      }
    }
  }
  long long int ans = solve(0, k);
  cout << ans << '\n';
}
