#include <bits/stdc++.h>
using namespace std;
map<char, vector<pair<int, int> > > d;
map<char, vector<pair<int, int> > >::iterator it;
char a[6000000];
int main() {
  pair<int, int> ins;
  string v[50];
  int us['z' + 100];
  char c;
  int i, j, n, m, first, z, tamp, tamq, s, t;
  vector<pair<int, int> > p, q;
  while (cin >> n >> m >> first) {
    first *= first;
    for (i = 0; i < n; i++) {
      cin >> v[i];
      for (j = 0; j < m; j++) {
        ins.first = i;
        ins.second = j;
        if (d.find(v[i][j]) == d.end()) d[v[i][j]] = p;
        d[v[i][j]].push_back(ins);
      }
    }
    if (d.find('S') != d.end()) {
      p = d['S'];
      tamp = p.size();
    }
    cin >> z;
    scanf("%s", a);
    for (i = 0; i <= 'z'; i++) us[i] = -1;
    for (j = i = 0; j < z; j++) {
      c = a[j];
      if (isupper(c)) {
        if (d.find('S') == d.end()) {
          i = -1;
          break;
        } else {
          if ((it = d.find(c = tolower(c))) == d.end()) {
            i = -1;
            break;
          } else {
            q = (*it).second;
            tamq = q.size();
            for (s = 0; us[c] == (-1) && s < tamp; s++) {
              for (t = 0; t < tamq; t++)
                if ((((p[s].first - q[t].first) * (p[s].first - q[t].first)) +
                     (((p[s].second - q[t].second) *
                       (p[s].second - q[t].second)))) <= first)
                  break;
              if (t < tamq) {
                us[c] = 0;
                break;
              }
            }
            if (us[c] != 0) us[c] = 1;
            i += us[c];
          }
        }
      } else if (d.find(c) == d.end()) {
        i = -1;
        break;
      }
    }
    printf("%d\n", i);
    d.clear();
    p.clear();
    q.clear();
  }
  return 0;
}
