#include <bits/stdc++.h>
using namespace std;
void zuka() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long double distance(pair<long double, long double> p1,
                     pair<long double, long double> p2) {
  long double dist;
  long double hld = ((p2.first - p1.first) * (p2.first - p1.first)) +
                    ((p2.second - p1.second) * (p2.second - p1.second));
  dist = sqrt(hld);
  return dist;
}
int main() {
  zuka();
  int n, m, h;
  cin >> n >> m >> h;
  char arr[35][35] = {};
  int freq[26] = {};
  int shifts = 0;
  vector<pair<long double, long double>> s_pos;
  map<pair<int, char>, pair<long double, long double>> mp;
  map<char, int> v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      if (arr[i][j] != 'S') {
        freq[arr[i][j] - 'a']++;
        mp[{freq[arr[i][j] - 'a'], arr[i][j]}] = {i, j};
      } else {
        shifts++;
        s_pos.push_back({(long double)i, (long double)j});
        mp[{shifts, arr[i][j]}] = {i, j};
      }
    }
  }
  int q;
  cin >> q;
  int res = 0;
  bool flag = false;
  for (int i = 0; i < q; i++) {
    bool cont = true;
    char s;
    cin >> s;
    if ((s >= 'A' && s <= 'Z' && (shifts == 0 || freq[(s + 32) - 'a'] == 0)) ||
        (s >= 'a' && s <= 'z' && freq[s - 'a'] == 0)) {
      cout << -1;
      flag = true;
      break;
    } else if (s >= 'A' && s <= 'Z' && shifts > 0 && v[s] == 0) {
      int times = 0;
      if (s >= 'A' && s <= 'Z' && shifts > 0 && freq[(s + 32) - 'a'] > 0) {
        int t = freq[(s + 32) - 'a'];
        while (t > 0) {
          for (int j = 0; j < s_pos.size(); j++) {
            if (s_pos[j].second == mp[{t, (s + 32)}].second) {
              if (abs(s_pos[j].first - mp[{t, (s + 32)}].first) > h)
                times++;
              else {
                times = 0;
                cont = false;
                break;
              }
            } else {
              if (distance(s_pos[j], mp[{t, (s + 32)}]) > h)
                times++;
              else {
                times = 0;
                cont = false;
                break;
              }
            }
          }
          if (times > 1) times = 1;
          if (!cont) break;
          t--;
        }
      }
      res += times;
      if (times != 0)
        v[s] = 2;
      else
        v[s] = 1;
    } else if (v[s] == 2)
      res++;
  }
  if (!flag) cout << res;
}
