#include <bits/stdc++.h>
using namespace std;
int r, c, ans;
double x, tdist[125];
char ptr, line[35][35];
vector<pair<int, int> > shift, letter[30];
bool invalid;
double dist_euclid(pair<int, int> a, pair<int, int> b) {
  return hypot(a.first - b.first, a.second - b.second);
}
void bfs() {
  for (char i = 0; i < 26; ++i) tdist[i + 'a'] = -1, tdist[i + 'A'] = -1;
  scanf("%d%d%lf", &r, &c, &x);
  for (int i = 0; i < r; ++i) {
    scanf("%s", line[i]);
    for (int j = 0; j < c; ++j) {
      if (line[i][j] != 'S')
        letter[line[i][j] - 'a'].push_back(make_pair(i, j)),
            tdist[line[i][j]] = 0;
      else
        shift.push_back(make_pair(i, j));
    }
  }
  for (unsigned i = 0; i < shift.size(); ++i)
    for (char j = 'a'; j <= 'z'; ++j)
      for (unsigned k = 0; k < letter[j - 'a'].size(); ++k) {
        ptr = 'A' + (j - 'a');
        double dd = dist_euclid(shift[i], letter[j - 'a'][k]);
        if (tdist[ptr] == -1 || dd < tdist[ptr]) tdist[ptr] = dd;
      }
  scanf("%d\n", &r);
  for (int i = 0; i < r; ++i) {
    ptr = getchar();
    (tdist[ptr] == -1) ? invalid = true : ans += (tdist[ptr] > x);
  }
  printf("%d\n", invalid ? -1 : ans);
}
int main() {
  bfs();
  return 0;
}
