#include <bits/stdc++.h>
using namespace std;
int n, m, k, v[110], c[110][110];
long long int dp[110][110][110];
long long int DP(int i, int j, int cr) {
  if (j < 0) return 10000000000000000LL;
  if (dp[i][j][cr] != -1) return dp[i][j][cr];
  if (i == 0 && j == 0) return dp[0][0][cr] = 0;
  if (i == 0) return dp[0][j][cr] = 10000000000000000LL;
  dp[i][j][cr] = 10000000000000000LL;
  if (v[i] == 1)
    for (int g = 2; g <= m + 1; g++)
      dp[i][j][cr] =
          min(dp[i][j][cr], DP(i - 1, j - ((g == cr) ? 0 : 1), g) + c[i][g]);
  else
    dp[i][j][cr] = DP(i - 1, j - ((v[i] == cr) ? 0 : 1), v[i]);
  return dp[i][j][cr];
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  memset(dp, -1, sizeof(dp));
  for (int g = 1; g <= n; g++) scanf("%d", &v[g]);
  for (int g = 1; g <= n; g++) v[g]++;
  for (int g = 1; g <= n; g++)
    for (int h = 2; h <= m + 1; h++) scanf("%d", &c[g][h]);
  long long int aux = DP(n, k, 0);
  if (aux == 10000000000000000LL)
    printf("-1");
  else
    printf("%lld", aux);
}
