#include <bits/stdc++.h>
using namespace std;
int n, m, q, ans;
double x;
char s[35][35], k, ss[500005];
bool haveTo[256];
vector<pair<int, int> > shifts;
int main(int argc, char** argv) {
  scanf("%d%d%lf", &n, &m, &x);
  shifts.clear();
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') {
        shifts.push_back({i, j});
      }
    }
  }
  memset(haveTo, 1, sizeof(haveTo));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      k = s[i][j];
      if (k >= 'a' && k <= 'z') {
        haveTo[k] = false;
      }
      if (s[i][j] == 'S') continue;
      for (int l = 0; l < shifts.size(); l++) {
        double dist = hypot(abs((double)i - shifts[l].first),
                            abs((double)j - shifts[l].second));
        if (dist < x || abs(dist - x) < 1e-9) {
          haveTo[s[i][j] - 'a' + 'A'] = false;
        }
      }
    }
  }
  scanf("%d", &q);
  scanf("%s", ss);
  ans = 0;
  for (int i = 0; i < q; i++) {
    if (ss[i] >= 'a' && ss[i] <= 'z' && haveTo[ss[i]]) {
      ans = -1;
      break;
    }
    if (ss[i] >= 'A' && ss[i] <= 'Z' &&
        (!shifts.size() || haveTo[ss[i] - 'A' + 'a'])) {
      ans = -1;
      break;
    }
    if (haveTo[ss[i]]) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
