#include <bits/stdc++.h>
using namespace std;
bool euclideanDistanceLessThan(long long x, pair<long long, long long> a,
                               pair<long long, long long> b) {
  double dist = double(sqrt((a.first - b.first) * (a.first - b.first) +
                            (a.second - b.second) * (a.second - b.second)));
  if (dist <= double(x)) return true;
  return false;
}
int main() {
  long long n, m, x;
  vector<string> s;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) {
    string t;
    cin >> t;
    s.push_back(t);
  }
  long long q;
  cin >> q;
  string t;
  cin >> t;
  map<char, bool> mm;
  bool s_present = false;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i][j] == 'S') {
        continue;
      }
      mm[s[i][j]] = true;
      bool found = false;
      for (int k = 0; k < n; k++) {
        for (int l = 0; l < m; l++) {
          if (s[k][l] == 'S') s_present = true;
          if (s[k][l] == 'S' &&
              euclideanDistanceLessThan(x, make_pair(k, l), make_pair(i, j))) {
            found = true;
            mm[char(s[i][j] - 32)] = true;
            break;
          }
        }
        if (found) break;
      }
    }
  }
  long long count = 0;
  for (int i = 0; i < q; i++) {
    if (t[i] >= 97 && t[i] <= 122) {
      if (!mm[t[i]]) {
        cout << -1;
        return 0;
      }
      continue;
    }
    if (t[i] >= 65 && t[i] <= 90) {
      if (mm[char(t[i] + 32)]) {
        if (!mm[t[i]]) {
          if (s_present)
            count++;
          else {
            cout << -1;
            return 0;
          }
        }
      } else {
        cout << -1;
        return 0;
      }
    }
  }
  cout << count;
  return 0;
}
