#include <bits/stdc++.h>
using namespace std;
mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T>
void chkmax(T& x, T y) {
  if (x < y) x = y;
}
template <typename T>
void chkmin(T& x, T y) {
  if (x > y) x = y;
}
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < 48) c = getchar();
  while (c > 47) x = x * 10 + (c ^ 48), c = getchar();
  return x;
}
const int maxn = 2e5 + 10;
int n, k, L;
int c[22], d[22][22];
long long dp[1 << 22];
char str[maxn];
void solve() {
  scanf("%d %d %d %s", &n, &k, &L, str + 1);
  for (int i = (0), iend = (k - 1); i <= iend; ++i) scanf("%d", c + i);
  for (int i = (0), iend = (k - 1); i <= iend; ++i)
    for (int j = (0), jend = (k - 1); j <= jend; ++j) scanf("%d", &d[i][j]);
  static int lst[26], ct[maxn][26];
  int vvv = 0;
  for (int i = (1), iend = (n); i <= iend; ++i) {
    int x = str[i] - 'A';
    vvv |= 1 << x;
    for (int ch = (0), chend = (k - 1); ch <= chend; ++ch) {
      ct[i][ch] = ct[i - 1][ch] + (ch == x);
      int j = lst[ch];
      if (j) {
        int S = 0, v = d[ch][x];
        for (int p = (0), pend = (k - 1); p <= pend; ++p)
          if (ct[i - 1][p] > ct[j][p]) S |= 1 << p;
        if ((~S >> x & 1) && (~S >> ch & 1)) {
          dp[S] += v, dp[S | 1 << x] -= v, dp[S | 1 << ch] -= v,
              dp[S | 1 << x | 1 << ch] += v;
        }
      }
    }
    lst[x] = i;
  }
  for (int i = (0), iend = (k - 1); i <= iend; ++i)
    for (int S = (0), Send = ((1 << k) - 1); S <= Send; ++S)
      if (S >> i & 1) dp[S] += dp[S ^ (1 << i)];
  int res = 0;
  for (int S = (0), Send = ((1 << k) - 1); S <= Send; ++S)
    if ((S & vvv) != vvv && (vvv & S) == S) {
      long long sum = dp[S];
      for (int i = (0), iend = (k - 1); i <= iend; ++i)
        if (S >> i & 1) sum += c[i];
      res += sum <= L;
    }
  cout << res << endl;
}
signed main() {
  solve();
  return 0;
}
