#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
long long n, k, T, lst[22], nxt[200005][22], a[22], b[22][22], sum[1 << 22],
    v[200005], hasnum, ans;
string s;
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> T >> s;
  fill(lst, lst + k, n);
  for (long long i = n - 1; i >= 0; --i) {
    v[i] = s[i] - 'A';
    memcpy(nxt[i], lst, sizeof(lst));
    lst[v[i]] = i;
    hasnum |= 1 << v[i];
  }
  for (long long i = 0; i < k; ++i) {
    cin >> a[i];
    sum[1 << i] = a[i];
  }
  for (long long i = 0; i < k; ++i) {
    for (long long j = 0; j < k; ++j) {
      cin >> b[i][j];
    }
  }
  for (long long i = 0; i < n; ++i) {
    vector<long long> tmp;
    for (long long j = 0; j < k; ++j) {
      if (nxt[i][j] != n) {
        tmp.push_back(nxt[i][j]);
      }
    }
    sort(tmp.begin(), tmp.end());
    long long g = 0;
    for (long long j = 0; j < tmp.size(); ++j) {
      sum[g] += b[v[i]][v[tmp[j]]];
      sum[g | (1 << v[i])] -= b[v[i]][v[tmp[j]]];
      sum[g | (1 << v[tmp[j]])] -= b[v[i]][v[tmp[j]]];
      sum[g | (1 << v[i]) | (1 << v[tmp[j]])] += b[v[i]][v[tmp[j]]];
      g |= 1 << v[tmp[j]];
    }
  }
  for (long long i = 0; i < k; ++i) {
    for (long long j = 0; j < 1 << k; ++j) {
      if (j & (1 << i)) {
        sum[j] += sum[j ^ (1 << i)];
      }
    }
  }
  for (long long i = 0; i < 1 << k; ++i) {
    if ((hasnum & i) != i || hasnum == i || sum[i] > T) {
      continue;
    }
    ++ans;
  }
  cout << ans << endl;
  return 0;
}
