#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[50];
  bool ada[256] = {0};
  double dekat[256];
  for (int i = 0; i < 256; i++) dekat[i] = 1000000000.0;
  int n, m;
  double x;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) cin >> s[i];
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') v.push_back(make_pair(i, j));
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') continue;
      ada[s[i][j]] = 1;
      for (int k = 0; k < v.size(); k++) {
        double temp = sqrt((v[k].first - i) * (v[k].first - i) +
                           (v[k].second - j) * (v[k].second - j));
        dekat[s[i][j]] = min(dekat[s[i][j]], temp);
      }
    }
  }
  int q;
  cin >> q;
  string qw;
  cin >> qw;
  int ans = 0;
  for (int i = 0; i < qw.length(); i++) {
    if (ada[qw[i]] == 1) continue;
    if (qw[i] >= 'a' && qw[i] <= 'z' && v.size() > 0) {
      if (ada[qw[i] - 32] == 0) {
        ans = -1;
        break;
      } else {
        if (dekat[qw[i] - 32] > x) {
          ans++;
        }
      }
    } else if (qw[i] >= 'A' && qw[i] <= 'Z' && v.size() > 0) {
      if (ada[qw[i] + 32] == 0) {
        ans = -1;
        break;
      } else {
        if (dekat[qw[i] + 32] > x) {
          ans++;
        }
      }
    } else {
      ans = -1;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
