#include <bits/stdc++.h>
using namespace std;
double distance(int x1, int y1, int x2, int y2) {
  double res = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
  return res;
}
int main() {
  double n, m, x;
  cin >> n >> m >> x;
  vector<pair<double, double> > shift;
  vector<pair<double, double> > b[26];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      if (c == 'S')
        shift.push_back(pair<double, double>(n - i + 0.5, j - 0.5));
      else
        b[c - 'a'].push_back(pair<double, double>(n - i + 0.5, j - 0.5));
    }
  }
  int l, cnt = 0;
  cin >> l;
  char* ch = new char[l + 1];
  int memo[26];
  for (int i = 0; i < 26; i++) memo[i] = -1;
  cin >> ch;
  for (int i = 0; i < l; i++) {
    if (ch[i] >= 'A' && ch[i] <= 'Z') {
      ch[i] = (char)(ch[i] + 32);
      if (memo[ch[i] - 'a'] == -1) {
        if (b[ch[i] - 'a'].size() == 0 || shift.size() == 0) {
          cout << -1;
          delete[] ch;
          return 0;
        }
        for (int j = 0; j < shift.size(); j++) {
          bool bo = 0;
          for (int k = 0; k < b[ch[i] - 'a'].size(); k++) {
            double x1, y1, x2, y2;
            x1 = shift[j].first;
            y1 = shift[j].second;
            x2 = b[ch[i] - 'a'][k].first;
            y2 = b[ch[i] - 'a'][k].second;
            if (distance(x1, y1, x2, y2) <= x) {
              bo = 1;
              break;
            }
          }
          if (bo) {
            memo[ch[i] - 'a'] = 1;
            break;
          }
          if (j == shift.size() - 1) {
            memo[ch[i] - 'a'] = 0;
            cnt++;
          }
        }
      } else if (memo[ch[i] - 'a'] == 0)
        cnt++;
      else
        continue;
    } else if (b[ch[i] - 'a'].size() == 0) {
      cout << -1;
      delete[] ch;
      return 0;
    } else
      continue;
  }
  cout << cnt;
  delete[] ch;
  return 0;
}
