#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
int n, m, k, ten[505][505], dp[505][505];
char mat[505][505];
vector<int> v[505];
int cnt[505];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> (mat[i] + 1);
    for (int j = 1; j <= m; j++)
      if (mat[i][j] == '1') {
        cnt[i]++;
        v[i].push_back(j);
      }
    fill(ten[i] + 1, ten[i] + 501, 1000000);
    if (!cnt[i]) continue;
    for (int j = 1; j <= cnt[i]; j++)
      for (int kk = 0; kk + j - 1 < cnt[i]; kk++)
        ten[i][j] = min(ten[i][j], v[i][kk + j - 1] - v[i][kk] + 1);
  }
  for (int i = 1; i <= n; i++) {
    fill(dp[i], dp[i] + k + 1, 1e6);
    for (int kk = 0; kk <= k; kk++)
      for (int j = 0; j <= kk && j <= cnt[i]; j++)
        dp[i][kk] = min(dp[i][kk], dp[i - 1][kk - j] + ten[i][cnt[i] - j]);
  }
  cout << *min_element(dp[n], dp[n] + 1 + k) << endl;
  return 0;
}
