#include <bits/stdc++.h>
using namespace std;
template <typename C>
auto test(C* x) -> decltype(cerr << *x, 0LL);
template <typename C>
char test(...);
template <typename C>
struct itr {
  C begin, end;
};
template <typename C>
itr<C> get_range(C b, C e) {
  return itr<C>{b, e};
};
struct debug {
  template <typename T>
  debug& operator<<(const T&) {
    return *this;
  }
};
string _ARR_(int* arr, int sz) {
  string ret = "{ " + to_string(arr[0]);
  for (int i = 1; i < sz; i++) ret += " , " + to_string(arr[i]);
  ret += " }";
  return ret;
}
const int INF = 1e9 + 7;
const int MxN = 510;
int dp[MxN][MxN], mn[MxN][MxN], in[MxN][MxN], classes[MxN];
int n, m, k;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  int total = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int cur = 0;
    for (int j = 0; j < m; j++) {
      in[i][j] = (s[j] - '0');
      cur += in[i][j];
    }
    classes[i] = cur;
    total += cur;
  }
  if (k >= total) {
    cout << 0 << '\n';
    return 0;
  }
  memset(mn, INF, sizeof mn);
  for (int i = 0; i < n; i++) {
    mn[i][0] = 0;
    for (int j = 0; j < m; j++) {
      int cur = 0;
      for (int x = j; x < m; x++) {
        cur += in[i][x];
        mn[i][cur] = min(mn[i][cur], x - j + 1);
      }
    }
  }
  memset(dp, INF, sizeof dp);
  k++;
  for (int j = 0; j <= k; j++) {
    int skip = (classes[0] - j < 0 ? classes[0] : classes[0] - j);
    dp[0][j] = (mn[0][skip]);
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int x = k - j; x >= 0; x--) {
        int skip = (classes[i] - x < 0 ? classes[i] : classes[i] - x);
        dp[i][j + x] = min(dp[i - 1][j] + mn[i][skip], dp[i][j + x]);
      }
    }
  }
  cout << dp[n - 1][k - 1] << '\n';
  return 0;
}
