#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, bool> mp;
  int n, m, x;
  cin >> n >> m >> x;
  vector<string> v(n);
  vector<pair<int, int> > s;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    for (int j = 0; j < m; ++j) {
      if (v[i][j] == 'S') {
        s.push_back(make_pair(i, j));
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (v[i][j] != 'S') {
        mp[v[i][j]] = true;
        for (int k = 0; k < s.size(); ++k) {
          int dist = ceil(sqrt(double(
              abs(double(s[k].first - i)) * abs(double(s[k].first - i)) +
              abs(double(s[k].second - j)) * abs(double(s[k].second - j)))));
          if (dist <= x) {
            mp[toupper(v[i][j])] = true;
          }
        }
      }
    }
  }
  int q, ct = 0;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    char ch;
    cin >> ch;
    if (isupper(ch)) {
      if (mp[tolower(ch)] && s.size()) {
        if (!mp[ch]) {
          ++ct;
        }
      } else {
        cout << "-1" << endl;
        return 0;
      }
    } else {
      if (!mp[ch]) {
        cout << "-1" << endl;
        return 0;
      }
    }
  }
  cout << ct << endl;
  return 0;
}
