#include <bits/stdc++.h>
using namespace std;
int n, m, x, q;
bool valid;
bool shift;
vector<pair<int, int> > coord[30];
vector<pair<int, int> > shiftCoord;
string s;
int ans = 0;
double data[30];
bool check_valid() {
  for (int i = 0; i < s.length(); i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      if (shiftCoord.empty()) return false;
      if (coord[s[i] - 65].empty()) return false;
    } else if (coord[s[i] - 97].empty())
      return false;
  }
  return true;
}
double dist(pair<int, int> i, pair<int, int> j) {
  return sqrt((i.first - j.first) * (i.first - j.first) +
              (i.second - j.second) * (i.second - j.second));
}
double min_dist(int idx) {
  double mini = 1000111000;
  for (int i = 0; i < coord[idx].size(); i++) {
    for (int j = 0; j < shiftCoord.size(); j++) {
      mini = min(mini, dist(coord[idx][i], shiftCoord[j]));
    }
  }
  return mini;
}
int main() {
  memset(data, -1, sizeof(data));
  for (int i = 0; i < 30; i++) coord[i].clear();
  shiftCoord.clear();
  scanf("%d %d %d", &n, &m, &x);
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < s.length(); j++) {
      if (s[j] == 'S')
        shiftCoord.push_back(make_pair(i, j));
      else
        coord[s[j] - 97].push_back(make_pair(i, j));
    }
  }
  scanf("%d", &q);
  cin >> s;
  if (check_valid()) {
    for (int i = 0; i < 30; i++) {
      if (!coord[i].empty() && !shiftCoord.empty()) data[i] = min_dist(i);
    }
    for (int i = 0; i < q; i++) {
      if (s[i] >= 'A' && s[i] <= 'Z') {
        if (data[s[i] - 65] > (double)x) ans++;
      }
    }
    printf("%d\n", ans);
  } else
    printf("-1");
  return 0;
}
