#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
int n, m, k;
string s[N];
int dp[N][N], t[N][N];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    vector<int> g;
    for (int j = 0; j < (int)s[i].size(); j++) {
      if (s[i][j] == '1') {
        g.push_back(j);
      }
    }
    t[i][0] = 0;
    for (int j = 1; j <= (int)g.size(); j++) {
      t[i][j] = g[j - 1] - g[0] + 1;
      for (int h = j + 1; h <= (int)g.size(); h++) {
        t[i][j] = min(t[i][j], g[h - 1] - g[h - j] + 1);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = inf;
    }
  }
  for (int i = 1; i <= n; i++) {
    int z = 0;
    for (int j = 0; j < m; j++) {
      z += s[i][j] - '0';
    }
    for (int j = 0; j <= k; j++) {
      dp[i][j] = min(dp[i][j], dp[i - 1][j] + t[i][z]);
    }
    for (int j = 0; j <= k; j++) {
      for (int h = 0; h <= min(j, z); h++) {
        dp[i][j] = min(dp[i][j], dp[i - 1][j - h] + t[i][z - h]);
      }
    }
  }
  int answ = inf;
  for (int i = 0; i <= k; i++) {
    answ = min(answ, dp[n][i]);
  }
  cout << answ << endl;
  return 0;
}
