#include <bits/stdc++.h>
using namespace std;
pair<int, pair<int, int>> sm[26];
map<int, vector<pair<int, int>>> smv;
int ca[26];
vector<pair<int, int>> sh;
int main(int argc, char const *argv[]) {
  int n, m, x;
  cin >> n >> m >> x;
  char a[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S')
        sh.push_back(make_pair(i, j));
      else {
        smv[a[i][j] - 'a'].push_back({i, j});
      }
    }
  }
  int c;
  cin >> c;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (isupper(s[i])) {
      ca[s[i] - 'A']++;
    } else {
      sm[s[i] - 'a'].first++;
    }
  }
  int mn = INT_MAX, sol = 0;
  for (int i = 0; i < 26; i++) {
    if (sm[i].first > 0 && smv[i].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    if (ca[i] > 0 && (smv[i].size() == 0 || !sh.size())) {
      cout << -1 << endl;
      return 0;
    }
    if (ca[i] > 0 && smv[i].size() > 0 && sh.size()) {
      mn = INT_MAX;
      for (int k = 0; k < smv[i].size(); k++) {
        for (int j = 0; j < sh.size(); j++) {
          int x1 = smv[i][k].first, x2 = sh[j].first, y1 = smv[i][k].second,
              y2 = sh[j].second;
          int z = pow(x1 - x2, 2) + pow(y1 - y2, 2);
          mn = min(mn, z);
        }
      }
      if (mn > x * x) {
        sol += ca[i];
      }
    }
  }
  cout << sol << endl;
  return 0;
}
