#include <bits/stdc++.h>
using namespace std;
double EulidDistance(int x1, int y1, int x2, int y2) {
  return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}
int main(int argc, const char *argv[]) {
  int n, m, x;
  cin >> n >> m >> x;
  vector<pair<char, pair<int, int> > > v;
  vector<pair<char, pair<int, int> > > sVector;
  unordered_map<char, double> umap;
  string a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < m; j++) {
      char c = a[i][j];
      if (c == 'S') {
        sVector.push_back(make_pair(c, make_pair(i + 1, j + 1)));
      } else {
        v.push_back(make_pair(c, make_pair(i + 1, j + 1)));
      }
    }
  }
  string t;
  int q;
  cin >> q;
  cin >> t;
  double minD = INT_MAX;
  for (int i = 0; i < v.size(); i++) {
    minD = INT_MAX;
    pair<int, int> coordinate = v[i].second;
    umap.insert(make_pair(v[i].first, 0));
    for (int j = 0; j < sVector.size(); j++) {
      pair<int, int> sCoordinate = sVector[j].second;
      double distance = EulidDistance(coordinate.first, coordinate.second,
                                      sCoordinate.first, sCoordinate.second);
      if (distance < minD) {
        minD = distance;
      }
    }
    if (sVector.size() > 0) {
      char c = toupper(v[i].first);
      unordered_map<char, double>::const_iterator found = umap.find(c);
      if (found == umap.end()) {
        umap.insert(make_pair(toupper(v[i].first), minD));
        continue;
      }
      if (minD < found->second) {
        umap.erase(found);
        umap.insert(make_pair(toupper(v[i].first), minD));
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < q; i++) {
    char c = t[i];
    if (umap.find(c) == umap.end()) {
      cout << -1;
      return 0;
    }
    if (umap[c] > x) {
      ans += 1;
    }
  }
  cout << ans;
  return 0;
}
