#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = 30;
int chr[N], R[N];
long long b[M][M], a[M], val[1 << 22], vv[M];
int vis[M], n, k, T, ans, all;
void dfs(int x, int st, long long sum) {
  if (sum > T) return;
  if (x == k) return (void)(ans += (sum + val[st] <= T && st != all));
  if (vis[x]) dfs(x + 1, st | (1 << x), sum + a[x]);
  dfs(x + 1, st, sum + vv[x]);
}
vector<int> pos[M];
pair<int, int> p[M];
int cnt;
void FWT(long long *f, int n) {
  for (int p = 2; p <= n; p <<= 1) {
    int len = p >> 1;
    for (int i = 0; i < n; i += p)
      for (int st = i; st < i + len; ++st) f[st + len] += f[st];
  }
}
signed main() {
  cin >> n >> k >> T;
  char ch;
  for (int i = 1; i <= n; ++i) {
    cin >> ch;
    chr[i] = ch - 'A';
    vis[chr[i]] = 1;
    all |= (1 << chr[i]);
    pos[chr[i]].push_back(i);
  }
  for (int i = 0; i < k; ++i) sort(pos[i].begin(), pos[i].end());
  for (int i = 0; i < k; ++i) cin >> a[i];
  for (int i = 0; i < k; ++i)
    for (int j = 0; j < k; ++j) cin >> b[i][j];
  for (int i = 2; i <= n; ++i)
    if (chr[i] == chr[i - 1])
      vv[chr[i]] += b[chr[i]][chr[i - 1]];
    else
      R[i] = i + 1;
  for (int i = 1; i < n; ++i) {
    if (chr[i] == chr[i + 1]) continue;
    int st = 0;
    cnt = 0;
    for (int j = 0; j < k; ++j)
      if (!pos[j].size() || pos[j].back() <= i)
        continue;
      else {
        int Pos = lower_bound(pos[j].begin(), pos[j].end(), i) - pos[j].begin();
        if (chr[i] == j && pos[j].size() > 1)
          p[++cnt] = make_pair(pos[j][Pos + 1], j);
        else
          p[++cnt] = make_pair(pos[j][Pos], j);
      }
    sort(p + 1, p + cnt + 1);
    for (int j = 1; j <= cnt; ++j) {
      if (i == p[j].first) continue;
      int tmp = b[chr[i]][p[j].second];
      val[st] += tmp;
      val[st | (1 << chr[i])] -= tmp;
      val[st | (1 << p[j].second)] -= tmp;
      val[st | (1 << p[j].second) | (1 << chr[i])] += tmp;
      if (p[j].second == chr[i]) break;
      st |= (1 << p[j].second);
    }
  }
  FWT(val, (1 << k));
  dfs(0, 0, 0);
  cout << ans;
  return 0;
}
