#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, scount = 0;
  cin >> n >> m >> x;
  vector<pair<int, int>> v;
  map<char, int> s;
  map<char, int> total;
  char arr[31][31];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      total[arr[i][j]]++;
      if (arr[i][j] == 'S') {
        v.push_back(make_pair(i, j));
        scount++;
      }
    }
  }
  for (auto z : v) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (arr[i][j] != 'S' && sqrt(pow((i + 1) - (z.first + 1), 2) +
                                     pow((j + 1) - (z.second + 1), 2)) <= x)
          s[arr[i][j]] = 1;
      }
    }
  }
  long long int len;
  cin >> len;
  char str[500005];
  cin >> str;
  long long int count = 0, ucount = 0;
  for (long long int i = 0; i < len; i++) {
    if (total[tolower(str[i])] == 0) {
      scount = 0;
      ucount = 1;
      break;
    }
    if (isupper(str[i])) {
      ucount++;
      if (s[tolower(str[i])] != 1) count++;
    }
  }
  if (scount == 0 && ucount != 0) count = -1;
  cout << count;
  return 0;
}
