#include <bits/stdc++.h>
using namespace std;
int toRight[200000 + 5][25];
char s[200000 + 5];
int c[25][25];
int cost_val[25];
int n, k, T;
vector<pair<int, int> > curr;
int val[4200000];
int f[4200000];
int cmask = 0;
bool cmp(pair<int, int> X, pair<int, int> Y) { return (X.first > Y.first); }
void process(int id) {
  int x = s[id - 1] - 'A';
  cmask |= 1 << x;
  while (!curr.empty()) curr.pop_back();
  for (int i = 1; i <= k; i++)
    if (toRight[id + 1][i] != -1)
      curr.push_back(pair<int, int>(toRight[id + 1][i], i));
  sort(curr.begin(), curr.end());
  int mask = 0;
  int last = 0;
  bool ok = false;
  for (int j = 0; j < curr.size(); j++) {
    int t = curr[j].second - 1;
    val[mask] += (c[x + 1][t + 1] - last);
    val[mask | 1 << x] += (last - c[x + 1][t + 1]);
    last = c[x + 1][t + 1];
    mask |= 1 << t;
    if (t == x) {
      ok = true;
      break;
    }
  }
  if (!ok) {
    val[mask] -= last;
    val[mask | 1 << x] += last;
  }
}
void solve() {
  for (int mask = 0; mask < (1 << k); mask++) f[mask] = val[mask];
  for (int i = k; i >= 1; i--)
    for (int mask = (1 << k) - 1; mask >= 0; mask--)
      if (mask & 1 << (i - 1)) f[mask] += f[mask ^ (1 << (i - 1))];
  int ans = 0;
  for (int mask = 0; mask < (1 << k); mask++) {
    int inverse_mask = 0;
    for (int i = 0; i < k; i++)
      if (!(mask & 1 << i)) inverse_mask |= 1 << i;
    if ((cmask & inverse_mask) == 0) continue;
    bool invalid = false;
    for (int i = 0; i < k; i++)
      if ((mask & 1 << i) && (!(cmask & 1 << i))) invalid = true;
    if (invalid) continue;
    int res = 0;
    for (int i = 0; i < k; i++)
      if (mask & 1 << i) res += cost_val[i + 1];
    if (res + f[mask] <= T) ans++;
  }
  printf("%d", ans);
}
void prepare() {
  for (int i = 1; i <= k; i++) toRight[n + 1][i] = -1;
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= k; j++)
      toRight[i][j] = (((s[i - 1] - 'A' + 1) == j) ? i : (toRight[i + 1][j]));
  for (int i = 1; i <= n; i++) process(i);
}
int main() {
  scanf("%d %d %d", &n, &k, &T);
  scanf("%s", &s);
  for (int i = 1; i <= k; i++) scanf("%d", &cost_val[i]);
  for (int i = 1; i <= k; i++)
    for (int j = 1; j <= k; j++) scanf("%d", &c[i][j]);
  prepare();
  solve();
}
