#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 10000;
void solve() {
  int n, m, x;
  vector<string> keyboard;
  set<char> found;
  map<char, vector<pair<int, int> > > place;
  vector<pair<int, int> > Splace;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) {
    string str;
    cin >> str;
    for (int j = 0; j < str.size(); j++) {
      if (str[j] != 'S') found.insert(str[j]);
      if (str[j] == 's' || str[j] == 'S') {
        if (str[j] == 'S') {
          Splace.push_back(make_pair(i, j));
        }
      } else {
      }
      place[str[j]].push_back(make_pair(i, j));
    }
    keyboard.push_back(str);
  }
  int chNum;
  cin >> chNum;
  string type;
  cin >> type;
  int dp[100];
  fill(dp, dp + 100, -1);
  bool no = false;
  int cnt = 0;
  for (int i = 0; i < type.size(); i++) {
    char ch;
    if (type[i] >= 'a' && type[i] <= 'z') {
      ch = type[i];
    } else
      ch = type[i] + 32;
    if (found.find(ch) == found.end()) {
      no = true;
      break;
    } else {
      if (!(type[i] >= 'a' && type[i] <= 'z')) {
        if (Splace.size() == 0) {
          no = true;
          break;
        } else {
          if (dp[type[i]] == 1) {
            continue;
          } else if (dp[type[i]] == 0) {
            cnt++;
            continue;
          }
          vector<pair<int, int> > vpii = place[type[i] + 32];
          bool nopush = false;
          for (int l = 0; l < vpii.size(); l++) {
            pair<int, int> p = place[type[i] + 32][l];
            for (int j = 0; j < Splace.size(); j++) {
              double dist =
                  (Splace[j].first - p.first) * (Splace[j].first - p.first);
              dist +=
                  (Splace[j].second - p.second) * (Splace[j].second - p.second);
              dist = sqrt(dist);
              if (((abs((dist) - (x)) < (1e-10)) || dist < x)) {
                nopush = true;
                break;
              }
            }
            if (nopush) break;
          }
          if (!nopush) {
            cnt++;
            dp[type[i]] = 0;
          } else {
            dp[type[i]] = 1;
          }
        }
      }
    }
  }
  if (no) {
    cout << -1 << endl;
  } else {
    cout << cnt << endl;
  }
}
int main() {
  solve();
  return 0;
}
