#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, first, l;
  string s, t;
  map<char, double> p;
  vector<pair<int, int> > v, vsml;
  vector<string> vs;
  cin >> n >> m >> first;
  for (int i = int(0); i < int(n); i++) {
    cin >> s;
    for (int j = int(0); j < int(s.size()); j++) {
      if (s[j] == 'S') {
        v.push_back(make_pair(i, j));
      }
      if (s[j] == 's') {
        vsml.push_back(make_pair(i, j));
      }
      p[s[j]] = numeric_limits<double>::infinity();
      ;
    }
    vs.push_back(s);
  }
  int ret = 0;
  cin >> l >> t;
  if (v.size() == 0 && vsml.size() == 0) {
    cout << -1;
    exit(0);
  }
  for (int i = int(0); i < int(n); i++) {
    for (int j = int(0); j < int(m); j++) {
      double mndis = numeric_limits<double>::infinity();
      ;
      if (v.size()) {
        for (int k = int(0); k < int(v.size()); k++) {
          double dis =
              (sqrt(pow(i - v[k].first, 2.0) + pow(j - v[k].second, 2.0)));
          if (dis < mndis) mndis = dis;
        }
      } else {
        for (int k = int(0); k < int(vsml.size()); k++) {
          double dis = (sqrt(pow(i - vsml[k].first, 2.0) +
                             pow(j - vsml[k].second, 2.0)));
          if (dis < mndis) mndis = dis;
        }
      }
      if (p[vs[i][j]] > mndis) {
        p[vs[i][j]] = mndis;
      }
    }
  }
  for (int i = int(0); i < int(l); i++) {
    char c = tolower(t[i]);
    if (!p.count(c)) {
      cout << -1;
      exit(0);
    }
    if (t[i] == 's' || t[i] == 'S') {
      if (!v.size() || !vsml.size()) {
        cout << -1;
        exit(0);
      }
    }
    if (c != t[i]) {
      if (p[c] > (double)first) {
        ret++;
      }
    }
  }
  cout << ret;
  return 0;
}
