#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
long long int dp[maxn][maxn];
long long int dp2[maxn][maxn];
long long int dp1[maxn][maxn];
long long int arr[maxn][maxn];
long long int ans[maxn];
void solve() {
  int n, m, k1;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k1);
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    vector<int> v;
    int flag = 0, cnt = 0;
    for (int i = 0; i <= (int)s.size() - 1; i++) {
      if (s[i] == '0' and flag == 0) continue;
      if (s[i] == '0') cnt++;
      if (s[i] == '1') {
        v.push_back(cnt + 1);
        cnt = 0;
        flag = 1;
      }
    }
    for (int len = 1; len <= (int)v.size(); len++) {
      long long int ans1 = LLONG_MAX;
      for (int k = 0; k <= (int)v.size() - 1; k++) {
        int j = k + len - 1;
        if (j >= (int)v.size()) continue;
        if (len == 1) {
          dp1[k][j] = v[j];
          dp2[k][j] = dp1[k][j];
          ans1 = min(ans1, dp2[k][j]);
          continue;
        } else {
          dp1[k][j] = v[j] + dp1[k][j - 1];
          dp2[k][j] = dp1[k][j] - v[k] + 1;
          ans1 = min(ans1, dp2[k][j]);
        }
      }
      ans[len] = ans1;
    }
    int len = (int)v.size();
    int k = 0;
    while (k <= k1) {
      if (len < 0) {
        arr[i - 1][k] = 0;
        k++;
        continue;
      }
      arr[i - 1][k] = ans[len];
      k++;
      len--;
    }
  }
  for (int i = 0; i <= n - 1; i++) {
    for (int j = 0; j <= k1; j++) {
      dp1[i][j] = LLONG_MAX;
      if (i == 0) {
        dp1[i][j] = arr[i][j];
        continue;
      }
      if (j == 0) {
        dp1[i][j] = arr[i][j] + dp1[i - 1][0];
        continue;
      }
      int start = 0, end = j;
      while (start <= j) {
        dp1[i][j] = min(dp1[i][j], dp1[i - 1][start] + arr[i][end]);
        start++;
        end--;
      }
    }
  }
  printf("%lld\n", dp1[n - 1][k1]);
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
