#include <bits/stdc++.h>
using namespace std;
void minimiza(int &a, int b) { a = min(a, b); }
const int infinito = 1000000000;
const int limite = 505;
int suma[limite];
int n, m, k;
int quedan[limite][limite];
int minimo[limite][limite];
int main() {
  cin >> n >> m >> k;
  for (int d = 1; d <= n; d++) {
    string s;
    cin >> s;
    s = '_' + s;
    int(&q)[limite] = quedan[d];
    for (int i = 1; i <= m; i++) suma[i] = suma[i - 1] + (s[i] == '1');
    if (suma[m] != 0) {
      for (int j = 0; j < limite; j++) q[j] = infinito;
      minimiza(q[suma[m]], 0);
      for (int i = 1; i <= m; i++) {
        for (int j = i; j <= m; j++) {
          int elim = suma[i - 1] + suma[m] - suma[j];
          minimiza(q[elim], j - i + 1);
        }
      }
      for (int i = 1; i < limite; i++) minimiza(q[i], q[i - 1]);
    }
    int(&miniant)[limite] = minimo[d - 1];
    int(&miniact)[limite] = minimo[d];
    for (int j = 0; j < limite; j++) miniact[j] = infinito;
    for (int i = 0; i < limite; i++)
      for (int j = 0; i + j < limite; j++)
        minimiza(miniact[i + j], miniant[i] + q[j]);
    for (int j = 1; j < limite; j++) minimiza(miniact[j], miniact[j - 1]);
  }
  cout << minimo[n][k] << endl;
}
