#include <bits/stdc++.h>
using namespace std;
long long gi() {
  char cc = getchar();
  long long cn = 0, flus = 1;
  while (cc < '0' || cc > '9') {
    if (cc == '-') flus = -flus;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') cn = cn * 10 + cc - '0', cc = getchar();
  return cn * flus;
}
const long long N = 2e5 + 5;
const long long M = (1 << 22) + 5;
long long n, m, T, limit, t[25], a[25][25], f[M], bef[25];
char s[N];
set<pair<long long, long long> > D;
set<pair<long long, long long> >::iterator it;
void add(long long u, long long v, long long S, long long z) {
  f[S] += z, f[S ^ (1 << u)] -= z, f[S ^ (1 << v)] -= z,
      f[S ^ (1 << u) ^ (1 << v)] += z;
}
void Add(long long u, long long S, long long z) {
  f[S] += z, f[S ^ (1 << u)] -= z;
}
signed main() {
  n = gi(), m = gi(), T = gi(), limit = (1 << m) - 1;
  scanf("%s", s + 1);
  for (register long long i = (0); i <= (m - 1); ++i) t[i] = gi();
  for (register long long i = (0); i <= (m - 1); ++i)
    for (register long long j = (0); j <= (m - 1); ++j) a[i][j] = gi();
  for (register long long i = (1); i <= (n); ++i) s[i] -= 'A';
  for (long long i = n; i >= 1; --i) {
    it = D.begin();
    long long tf = 0;
    for (; it != D.end(); ++it) {
      if ((*it).second == s[i]) {
        Add((*it).second, limit ^ tf, a[(long long)s[i]][(long long)s[i]]);
        break;
      }
      add(s[i], (*it).second, limit ^ tf, a[(long long)s[i]][(*it).second]);
      tf ^= (1 << (*it).second);
    }
    if (bef[(long long)s[i]])
      D.erase(make_pair(bef[(long long)s[i]], (long long)s[i]));
    bef[(long long)s[i]] = i;
    D.insert(make_pair(i, (long long)s[i]));
  }
  long long o = 0;
  for (register long long i = (0); i <= (m - 1); ++i)
    if (!bef[i]) o |= (1 << i);
  for (register long long k = 1; k <= limit; k <<= 1)
    for (register long long i = (0); i <= (limit); ++i)
      if (!(i & k)) f[i] += f[i ^ k];
  long long Ans = 0;
  for (register long long i = (1); i <= (limit); ++i) {
    long long S = (limit ^ i), z = f[i];
    if ((i & o) != o || i == o) continue;
    for (register long long j = (0); j <= (m - 1); ++j)
      if (((1 << j) & S)) z += t[j];
    if (z <= T) ++Ans;
  }
  cout << Ans << endl;
  return 0;
}
