#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 10, maxC = 23, maxMSK = 4194304 + 20;
int c[maxC], cs[maxC][maxC];
long long MSK[maxMSK], CMM;
pair<int, int> lst[maxC];
char ch[maxN];
int main() {
  int n, k, t;
  scanf("%d%d%d", &n, &k, &t);
  scanf("%s", ch);
  for (int i = 0; i < n; i++) CMM |= (1 << (ch[i] - 'A'));
  CMM ^= ((1 << k) - 1);
  for (int i = 0; i < k; i++) scanf("%d", &c[i]);
  for (int i = 0; i < k; i++)
    for (int j = 0; j < k; j++) scanf("%d", &cs[i][j]);
  for (int i = 0; i < k; i++) lst[i] = {n, i};
  for (int i = n - 1; i >= 0; i--) {
    int bef = 0, msk = 0;
    for (int j = 0; j < k && lst[j].first < n; j++) {
      int num = cs[ch[i] - 'A'][lst[j].second] - bef;
      MSK[msk] += num;
      MSK[msk ^ (1 << (ch[i] - 'A'))] -= num;
      bef = cs[ch[i] - 'A'][lst[j].second];
      msk |= (1 << lst[j].second);
      if (lst[j].second == (ch[i] - 'A')) break;
    }
    if (!(((msk) >> ((ch[i] - 'A'))) & 1)) {
      MSK[msk] -= bef;
      MSK[msk ^ (1 << (ch[i] - 'A'))] += bef;
    }
    for (int j = 0; j < k; j++) swap(lst[j].first, lst[j].second);
    sort(lst, lst + k);
    lst[ch[i] - 'A'].second = i;
    for (int j = 0; j < k; j++) swap(lst[j].first, lst[j].second);
    sort(lst, lst + k);
  }
  for (int i = 0; i < k; i++) {
    for (int j = (1 << k) - 1; j >= 0; j--) {
      if ((((j) >> (i)) & 1)) MSK[j] += MSK[j ^ (1 << i)];
    }
  }
  int ans = 0;
  for (int i = 0; i < (1 << k); i++) {
    if (i & CMM) continue;
    if ((CMM | i) == ((1 << k) - 1)) continue;
    for (int j = 0; j < k; j++) {
      if ((((i) >> (j)) & 1)) MSK[i] += c[j];
    }
    if (MSK[i] <= t) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
