#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, m, K, a[N][N], cnt;
char s[N];
inline void init() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (int j = 1; j <= m; j++) {
      int c = s[j] - '0';
      if (c) a[i][++a[i][0]] = j, ++cnt;
    }
  }
  K = min(K, cnt);
}
const int INF = 1e9;
int dp[N][N], g[N][N];
inline void prepare() {
  for (int i = 1; i <= n; i++) {
    g[i][0] = 0;
    for (int k = 1; k <= a[i][0]; k++) {
      g[i][k] = INF;
      for (int j = 1; j + k - 1 <= a[i][0]; j++) {
        g[i][k] = min(g[i][k], a[i][j + k - 1] - a[i][j] + 1);
      }
    }
  }
  memset(dp, 127 / 3, sizeof dp);
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= K; j++) {
      if (dp[i - 1][j] != dp[0][1]) {
        for (int k = 0; k + j <= K; k++) {
          dp[i][j + k] = min(dp[i][j + k], dp[i - 1][j] + g[i][a[i][0] - k]);
        }
      }
    }
  }
  printf("%d\n", dp[n][K]);
}
inline void solve() { prepare(); }
int main() {
  init();
  solve();
  return 0;
}
