#include <bits/stdc++.h>
using namespace std;
long long int n, m, k, ar[102], p[102][102], dp[105][105][105];
long long int recur(long long int i, long long int j, long long int l) {
  if (i == n) {
    if (j == k) return 0;
    return 1000000000009;
  }
  if (dp[i][j][l] != -1) return dp[i][j][l];
  if (ar[i] == 0) {
    long long int s = 10000000000009;
    for (long long int x = 1; x <= m; x++) {
      if (x == l) {
        s = min(s, recur(i + 1, j, l) + p[i][x - 1]);
      } else
        s = min(s, recur(i + 1, j + 1, x) + p[i][x - 1]);
    }
    return dp[i][j][l] = s;
  } else {
    if (ar[i] == l) return dp[i][j][l] = recur(i + 1, j, l);
    return dp[i][j][l] = recur(i + 1, j + 1, ar[i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; i < 105; i++)
    for (int j = 0; j < 105; j++)
      for (int k = 0; k < 105; k++) dp[i][j][k] = -1;
  cin >> n >> m >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> p[i][j];
    }
  }
  long long int ans = recur(0, 0, 104);
  if (ans > 1000000000000)
    cout << -1;
  else
    cout << ans;
}
