#include <bits/stdc++.h>
using namespace std;
const int MN = 1 << 23, MK = 23;
int dp[MN] = {}, lst[MN], del[MK], bd[MK][MK];
int main() {
  int n, k, t;
  cin >> n >> k >> t;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) s[i] -= 'A';
  for (int i = 0; i < k; i++) cin >> del[i];
  cerr << endl;
  for (int i = 0; i < k; i++) dp[1 << i] += del[i];
  for (int i = 0; i < k; i++)
    for (int j = 0; j < k; j++) cin >> bd[i][j];
  for (int i = 0; i < k; i++) lst[i] = -1;
  for (int i = 0; i < n; i++) {
    vector<pair<int, int> > vec;
    for (int i = 0; i < k; i++)
      if (lst[i] != -1) vec.push_back({lst[i], i});
    sort(vec.rbegin(), vec.rend());
    int msk = 0;
    for (auto [k, c] : vec) {
      int val = bd[c][s[i]];
      if (c == s[i]) {
        dp[msk] += val;
        dp[msk ^ (1 << c)] -= val;
        break;
      } else {
        dp[msk] += val;
        dp[msk | (1 << c)] -= val;
        dp[msk | (1 << s[i])] -= val;
        dp[msk | (1 << c) | (1 << s[i])] += val;
        msk |= (1 << c);
      }
    }
    lst[s[i]] = i;
  }
  for (int i = 0; i < k; i++)
    for (int msk = 0; msk < (1 << k); msk++)
      if (msk >> i & 1) dp[msk] += dp[msk ^ (1 << i)];
  int ans = 0, gd = 0;
  for (int i = 0; i < k; i++)
    if (lst[i] != -1) gd |= (1 << i);
  for (int msk = 0; msk < (1 << k) - 1; msk++) {
    if ((msk | gd) == gd && msk ^ gd) ans += (dp[msk] <= t);
  }
  cout << ans;
}
