#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool isLower(char c) { return c - 'a' >= 0 && c - 'a' < 26; }
bool isUpper(char c) { return c - 'A' >= 0 && c - 'A' < 26; }
char toLower(char c) {
  if (c - 'a' >= 0 && c - 'a' < 26) {
    return c;
  }
  int val = c - 'A';
  return 'a' + val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  double x;
  cin >> n >> m >> x;
  vector<vector<char>> v(n, vector<char>(m));
  vector<pair<double, double>> shift;
  unordered_map<char, double> mp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> v[i][j];
      if (v[i][j] == 'S') {
        shift.push_back(make_pair(i + 1, j + 1));
      }
      mp[v[i][j]] = 1e9;
    }
  }
  string s;
  int ssize;
  cin >> ssize >> s;
  bool noShift = true;
  if (shift.size() > 0) {
    noShift = false;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (isLower(v[i][j])) {
        for (int k = 0; k < shift.size(); k++) {
          double x = i + 1;
          double y = j + 1;
          mp[v[i][j]] = min(sqrt((x - shift[k].first) * (x - shift[k].first) +
                                 (y - shift[k].second) * (y - shift[k].second)),
                            mp[v[i][j]]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    char tmp = toLower(s[i]);
    if (mp.find(tmp) == mp.end()) {
      cout << -1 << '\n';
      return 0;
    }
    if (isUpper(s[i])) {
      if (noShift) {
        cout << -1 << '\n';
        return 0;
      }
      if (mp[tmp] > x) {
        ans++;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
