#include <bits/stdc++.h>
using namespace std;
inline void setmin(int &x, int y) {
  if (y < x) x = y;
}
inline void setmax(int &x, int y) {
  if (y > x) x = y;
}
inline void setmin(long long &x, long long y) {
  if (y < x) x = y;
}
inline void setmax(long long &x, long long y) {
  if (y > x) x = y;
}
const int N = 501;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
int cnt[N][N];
int dp[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    vector<int> p;
    for (int j = 0; j < m; j++)
      if (s[j] == '1') p.push_back(j);
    for (int miss = 0; miss < k + 1; miss++) {
      if (miss >= (int)p.size())
        cnt[i][miss] = 0;
      else {
        cnt[i][miss] = inf;
        for (int j = 0; j < miss + 1; j++)
          setmin(cnt[i][miss], p[(int)p.size() - 1 - (miss - j)] - p[j] + 1);
      }
    }
  }
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < k + 1; j++) dp[i][j] = inf;
  dp[0][0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < k + 1; j++)
      for (int miss = 0; miss < j + 1; miss++)
        setmin(dp[i + 1][j], dp[i][j - miss] + cnt[i][miss]);
  int ans = inf;
  for (int j = 0; j < k + 1; j++) setmin(ans, dp[n][j]);
  cout << ans << "\n";
  return 0;
}
