#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<pair<int, int>> alpahabet[26];
  vector<pair<int, int>> shiftkays;
  vector<string> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    string s = v[i];
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == 'S') {
        shiftkays.push_back({i, j});
      } else {
        alpahabet[s[j] - 'a'].push_back({i, j});
      }
    }
  }
  bool can[26];
  memset(can, false, sizeof(can));
  for (int i = 0; i < 26; i++) {
    double distance = 10000000000;
    for (int k = 0; k < alpahabet[i].size(); k++) {
      pair<int, int> aplha = alpahabet[i][k];
      for (int j = 0; j < shiftkays.size(); j++) {
        pair<int, int> pairr = shiftkays[j];
        double dist = sqrt((pow(abs(pairr.first - aplha.first), 2)) +
                           (pow(abs(pairr.second - aplha.second), 2)));
        distance = min(dist, distance);
      }
    }
    if (distance <= (double)x) can[i] = true;
  }
  int q;
  cin >> q;
  string t;
  cin >> t;
  int cnt = 0;
  for (int i = 0; i < q; i++) {
    if (isupper(t[i]) && shiftkays.size() == 0) {
      cout << -1;
      return 0;
    }
    char c = tolower(t[i]);
    if (alpahabet[c - 'a'].size() == 0) {
      cout << -1;
      return 0;
    }
    if (isupper(t[i])) {
      if (!can[c - 'a']) cnt++;
    }
  }
  cout << cnt;
  return 0;
}
