#include <bits/stdc++.h>
using namespace std;
int n, m, lim;
char s[200200];
int adj[22 + 7][22 + 7], val[22 + 7];
int totCost[(1 << (22)) + 7], maskCost[(1 << (22)) + 7];
int fjoasidj[200200][22 + 7];
void init(void) {
  scanf("%d%d%d", &n, &m, &lim);
  scanf("%s", s + 1);
  for (int i = 0, _n = (m); i < _n; i = i + 1) scanf("%d", &val[i]);
  for (int i = 0, _n = (m); i < _n; i = i + 1)
    for (int j = 0, _n = (m); j < _n; j = j + 1) scanf("%d", &adj[i][j]);
}
void prepare(void) {
  for (int i = 0, _n = (m); i < _n; i = i + 1) fjoasidj[n][i] = n + 1;
  for (int i = (n - 1), _a = (0); i >= _a; i = i - 1) {
    for (int j = 0, _n = (m); j < _n; j = j + 1)
      fjoasidj[i][j] = fjoasidj[i + 1][j];
    fjoasidj[i][s[i + 1] - 'A'] = i + 1;
  }
  for (int i = (1), _b = (n); i <= _b; i = i + 1) {
    vector<pair<int, int> > ch;
    for (int j = 0, _n = (m); j < _n; j = j + 1)
      if (fjoasidj[i][j] <= n) ch.push_back(make_pair(fjoasidj[i][j], j));
    sort((ch).begin(), (ch).end());
    int mask = 0;
    for (__typeof((ch).begin()) it = (ch).begin(); it != (ch).end(); it++) {
      int tmp = adj[s[i] - 'A'][it->second];
      maskCost[mask] += tmp;
      maskCost[mask | (1 << (s[i] - 'A'))] -= tmp;
      maskCost[mask | (1 << (it->second))] -= tmp;
      maskCost[mask | (1 << (s[i] - 'A')) | (1 << (it->second))] += tmp;
      mask |= (1 << (it->second));
      if (it->second == s[i] - 'A') break;
    }
  }
}
void calcCost(int l, int r) {
  if (l + 1 == r) {
    totCost[l] = maskCost[l];
    return;
  }
  int m = (l + r) >> 1;
  calcCost(l, m);
  calcCost(m, r);
  for (int i = (l), _b = (m - 1); i <= _b; i = i + 1)
    totCost[i + m - l] += totCost[i];
}
void process(void) {
  calcCost(0, (1 << (m)));
  for (int i = 0, _n = ((1 << (m))); i < _n; i = i + 1)
    for (int j = 0, _n = (m); j < _n; j = j + 1)
      if ((((i) >> (j)) & 1)) totCost[i] += val[j];
  int charMask = 0;
  for (int i = (1), _b = (n); i <= _b; i = i + 1)
    charMask |= (1 << (s[i] - 'A'));
  int res = 0;
  for (int i = 0, _n = ((1 << (m))); i < _n; i = i + 1)
    if (i != charMask && (i & charMask) == i && totCost[i] <= lim) res++;
  printf("%d\n", res);
}
int main(void) {
  init();
  prepare();
  process();
  return 0;
}
