#include <bits/stdc++.h>
using namespace std;
double findMinDist(vector<pair<long long, long long>> &shift, long long i,
                   long long j) {
  double ans = INT_MAX;
  for (long long x = 0; x < shift.size(); x++) {
    double tt;
    double n = shift[x].first;
    double m = shift[x].second;
    tt = sqrt((n - i) * (n - i) + (m - j) * (m - j));
    ans = min(ans, tt);
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  unordered_map<char, vector<pair<long long, long long>>> mp;
  vector<pair<long long, long long>> shift;
  for (long long x = 1; x <= n; x++) {
    string s;
    cin >> s;
    for (long long y = 1; y <= m; y++) {
      char ch = s[y - 1];
      if (ch == 'S') {
        shift.push_back(make_pair(x, y));
        continue;
      }
      mp[ch].push_back(make_pair(x, y));
    }
  }
  long long q;
  cin >> q;
  string s;
  cin >> s;
  long long count = 0;
  long long c = 0;
  unordered_map<char, bool> can;
  for (long long x = 0; x < 26; x++) {
    char ch = x + 'a';
    double dist = INT_MAX;
    vector<pair<long long, long long>> ppppp = mp[ch];
    for (auto &[i, j] : ppppp) {
      dist = min(dist, findMinDist(shift, i, j));
    }
    if (dist <= k) {
      can[ch] = true;
    }
  }
  for (long long x = 0; x < s.length(); x++) {
    char ch = s[x];
    if (isupper(ch)) {
      c++;
      if (shift.size() == 0) {
        cout << -1;
        exit(0);
      }
      ch = tolower(ch);
      if (mp[ch].size() == 0) {
        cout << -1 << endl;
        exit(0);
      }
      if (!can[ch]) {
        count++;
      }
    } else if (mp[ch].size() == 0) {
      cout << -1 << endl;
      exit(0);
    }
  }
  cout << count << endl;
}
