#include <bits/stdc++.h>
using namespace std;
long long t[505];
long long p[505][505];
long long dp[505][505];
const long long oo = 4557430888798830399LL;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<string> s(n);
  for (auto &i : s) cin >> i;
  memset(p, 63, sizeof p);
  memset(dp, 63, sizeof dp);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) t[j + 1] = t[j] + s[i][j] - '0';
    for (int j = 1; j <= m; ++j)
      if (s[i][j - 1] == '1')
        for (int l = j; l <= m; ++l)
          if (s[i][l - 1] == '1')
            p[i][t[m] - t[l] + t[j - 1]] =
                min(p[i][t[m] - t[l] + t[j - 1]], (long long)l - j + 1);
    p[i][t[m]] = 0;
  }
  dp[0][0] = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j <= k; ++j)
      if (dp[i][j] != oo)
        for (int l = k - j; l >= 0; --l)
          if (p[i][l] != oo)
            dp[i + 1][j + l] = min(dp[i + 1][j + l], dp[i][j] + p[i][l]);
  long long ans = oo;
  for (int i = 0; i <= k; ++i) ans = min(ans, dp[n][i]);
  cout << ans;
  return 0;
}
