#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, ps;
  cin >> n >> m >> ps;
  vector<string> keys;
  vector<pair<int, int>> pos;
  bool can[1000];
  memset(can, 0, sizeof(can));
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    keys.push_back(s);
    for (int k = 0; k < s.size(); k++) {
      if (s[k] == 'S') {
        pos.push_back(make_pair(i, k));
      }
    }
  }
  bool found[1000];
  memset(found, 0, sizeof(found));
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < m; k++) {
      double dist = 1000000007;
      double distance;
      if (keys[i][k] == 'S') {
        continue;
      }
      found[keys[i][k]] = 1;
      for (int j = 0; j < pos.size(); j++) {
        int x = k - pos[j].second;
        int y = i - pos[j].first;
        distance = pow(y, 2) + pow(x, 2);
        distance = sqrt(distance);
        dist = min(dist, distance);
      }
      if (dist <= ps) {
        can[keys[i][k] - 32] = 1;
      }
    }
  }
  long long q;
  cin >> q;
  char ch;
  int ans = 0;
  for (int i = 0; i < q; i++) {
    cin >> ch;
    if (!isupper(ch)) {
      if (!found[ch]) {
        cout << -1;
        return 0;
      }
      continue;
    }
    if (!found[tolower(ch)]) {
      cout << -1 << '\n';
      return 0;
    }
    if (pos.empty()) {
      cout << -1 << '\n';
      return 0;
    }
    if (can[ch] == 0) {
      ans++;
    }
  }
  cout << ans << '\n';
}
