#include <bits/stdc++.h>
using namespace std;
const int N = 507, mod = 60, INF = 1e9 - 1;
const double PI = 3.141592653589793238462643383279502884197, eps = 1e-6;
int n, arr[N][N], memo[N][N], c[N];
int dp(int ind, int rem) {
  if (ind == n) return 0;
  int &ret = memo[ind][rem];
  if (ret != -1) return ret;
  ret = INF;
  for (int i = 0; i <= rem && i <= c[ind]; i++)
    ret = min(ret, dp(ind + 1, rem - i) + arr[ind][i]);
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int m, k;
  cin >> n >> m >> k;
  string s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) c[i] += (s[i][j] == '1');
  memset(arr, 7, sizeof arr);
  memset(memo, -1, sizeof arr);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == '1') {
        int cnt = 0;
        for (int k = j; k < m; k++) {
          if (s[i][k] == '1') {
            cnt++;
            arr[i][c[i] - cnt] = min(arr[i][c[i] - cnt], k - j + 1);
          }
        }
      }
    }
    arr[i][c[i]] = 0;
  }
  cout << dp(0, k);
  return 0;
}
