#include <bits/stdc++.h>
using namespace std;
int main() {
  long double a, z;
  long double x;
  cin >> a >> z >> x;
  map<char, vector<pair<long double, long double>>> m;
  vector<pair<long double, long double>> s;
  map<char, bool> b;
  for (long double i = 1; i <= a; i++) {
    for (long double j = 1; j <= z; j++) {
      char temp;
      cin >> temp;
      if (temp == 'S') {
        s.push_back(make_pair(i, j));
        continue;
      }
      m[temp].push_back(make_pair(i, j));
    }
  }
  long long t;
  cin >> t;
  long long flag = 1;
  long long c = 0;
  for (long long i = 0; i < t; i++) {
    char temp;
    cin >> temp;
    if (!m.count(tolower(temp))) {
      cout << "-1" << '\n';
      flag = 0;
      break;
    }
    if (isupper(temp)) {
      temp = tolower(temp);
      if (s.size() == 0) {
        cout << "-1" << '\n';
        flag = 0;
        break;
      }
      long long min = 1000000000000000;
      if (!(b.count(temp))) {
        for (auto v : m[temp]) {
          for (auto f : s) {
            long double x2 = f.first, y2 = f.second;
            long double x1 = v.first, y1 = v.second;
            sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) <= x ? b[temp] = true
                                                         : b[temp] = false;
            if (b[temp]) {
              break;
            }
          }
          if (b[temp]) {
            break;
          }
        }
        if (b[temp] == false) {
          c++;
        }
      } else {
        if (!(b[temp])) {
          c++;
        }
      }
    }
  }
  if (flag) {
    cout << c << '\n';
  }
  return 0;
}
