#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const int MN = 2e5 + 10, MA = 23, MS = (1 << 22) + 10;
long long val[MS], dp[MS], Base[MS];
int n, k, T;
string s;
char inp[MN];
int lst[MA], adj[MA][MA], cost[MA];
int ps[MA][MN];
void prep() {
  memset(lst, -1, sizeof lst);
  for (int i = 0; i < n; ++i) {
    int v = s[i] - 'A';
    for (int j = 0; j < k; ++j) ps[j][i + 1] = ps[j][i];
    ps[v][i + 1]++;
  }
  for (int i = 0; i < n; ++i) {
    int v = s[i] - 'A';
    for (int j = 0; j < k; ++j)
      if (lst[j] > lst[v]) {
        int M = 0;
        for (int l = 0; l < k; ++l)
          if (ps[l][i] - ps[l][lst[j] + 1]) {
            M |= (1 << l);
          }
        int tmp = adj[j][v];
        val[M] += tmp, val[M | (1 << v)] -= tmp;
        val[M | (1 << j)] -= tmp, val[M | (1 << v) | (1 << j)] += tmp;
      }
    if (~lst[v]) {
      int M = 0;
      for (int l = 0; l < k; ++l)
        if (ps[l][i] - ps[l][lst[v] + 1]) M |= (1 << l);
      int tmp = adj[v][v];
      val[M] += tmp, val[M | (1 << v)] -= tmp;
    }
    lst[v] = i;
  }
}
void make_dp() {
  for (int msk = 0; msk < (1 << k); ++msk) Base[msk] = dp[msk] = val[msk];
  for (int i = k - 1; ~i; --i) {
    for (int msk = 0; msk < (1 << k); ++msk) {
      dp[msk] = Base[msk];
      if (msk & (1 << i)) dp[msk] += Base[msk ^ (1 << i)];
    }
    for (int msk = 0; msk < (1 << k); ++msk) Base[msk] = dp[msk];
  }
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  scanf("%d %d %d\n", &n, &k, &T);
  scanf("%s\n", inp);
  s = inp;
  for (int i = 0; i < k; ++i) scanf("%d ", &cost[i]);
  scanf("\n");
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < k; ++j)
      if (j < k - 1)
        scanf("%d ", &adj[i][j]);
      else
        scanf("%d\n", &adj[i][j]);
  }
  prep();
  make_dp();
  int ans = 0;
  int V = 0;
  for (int i = 0; i < k; ++i)
    if (ps[i][n] - ps[i][0]) ++V;
  for (int msk = 0; msk < (1 << k); ++msk) {
    bool Fail = false;
    int cnt = 0;
    for (int i = 0; i < k; ++i)
      if (msk & (1 << i)) {
        if (ps[i][n] - ps[i][0] == 0)
          Fail = true;
        else
          ++cnt;
      }
    if (cnt == V) Fail = true;
    if (Fail) continue;
    long long v = 0;
    for (int i = 0; i < k; ++i)
      if (msk & (1 << i)) v += cost[i];
    v += dp[msk];
    ans += (v <= T);
  }
  printf("%d\n", ans);
  return 0;
}
