#include <bits/stdc++.h>
using namespace std;
int n, K, id[30], pre[30], Z;
long long t[30], cst[30][30], T, dp[1 << 22];
char S[201000];
int main() {
  scanf("%d%d", &n, &K);
  scanf("%lld", &T);
  scanf("%s", S + 1);
  for (int i = 1; i <= K; ++i) scanf("%lld", &t[i]);
  for (int i = 1; i <= K; ++i)
    for (int j = 1; j <= K; ++j) scanf("%lld", &cst[i][j]);
  for (int i = 1; i <= K; ++i) dp[1 << i - 1] = t[i];
  for (int i = 1; i <= K; ++i) pre[i] = 0, id[i] = i;
  for (int i = 1; i <= n; ++i) {
    int wxh = S[i] - 'A' + 1;
    Z |= (1 << wxh - 1);
    sort(id + 1, id + K + 1, [](int x, int y) { return pre[x] > pre[y]; });
    for (int j = 1, S = 0; j <= K && pre[id[j]]; S |= 1 << id[j] - 1, j++) {
      dp[S] += cst[id[j]][wxh];
      dp[S | (1 << id[j] - 1)] -= cst[id[j]][wxh];
      dp[S | (1 << wxh - 1)] -= cst[id[j]][wxh];
      dp[S | (1 << id[j] - 1) | (1 << wxh - 1)] += cst[id[j]][wxh];
      if (id[j] == wxh) break;
    }
    pre[wxh] = i;
  }
  for (int i = 0; i < K; ++i)
    for (int j = 0; j < (1 << K); ++j)
      if (j >> i & 1) dp[j] += dp[j ^ (1 << i)];
  int ans = 0;
  for (int i = 0; i < (1 << K); ++i)
    if ((i & Z) == i && i != Z && dp[i] <= T) ans++;
  printf("%d", ans);
}
