#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return (b == 0) ? a : GCD(b, a % b); }
bool isPrime(int x) {
  for (int i = 2; i <= sqrt(x); i++)
    if (x % i == 0) return 0;
  return 1;
}
int C[26 * 3];
bool have[27];
double dist(int a, int b, int i, int y) {
  return sqrt(pow(a - i, 2) + pow(b - y, 2));
}
int main() {
  int n, m, x, t;
  cin >> n >> m >> x;
  vector<string> v(n);
  vector<pair<int, int> > S;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int k = 0; k < m; k++) {
      if (s[k] == 'S') {
        have[26] = 1;
        S.push_back(make_pair(i, k));
      } else
        have[s[k] - 'a'] = 1;
    }
    v[i] = s;
  }
  string s;
  cin >> t >> s;
  bool bad = 0;
  for (int i = 0; i < t; i++) {
    char c = s[i];
    C[c - 'A']++;
    if (have[tolower(c) - 'a'] == 0) {
      bad = 1;
      break;
    }
    if (c < 'a') {
      if (have[26] == 0) {
        bad = 1;
        break;
      }
    }
  }
  if (bad) {
    cout << -1;
    return 0;
  }
  vector<vector<int> > anss(26);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (C[toupper(v[i][j]) - 'A'] == 0 || v[i][j] == 'S')
        continue;
      else {
        double d = 99999999;
        for (int k = 0; k < S.size(); k++) {
          d = min(dist(i, j, S[k].first, S[k].second), d);
        }
        if (d > x) ans += C[toupper(v[i][j]) - 'A'];
        anss[v[i][j] - 'a'].push_back(ans);
        ans = 0;
      }
    }
  }
  ans = 0;
  for (int i = 0; i < 26; i++) {
    sort(anss[i].begin(), anss[i].end());
    if (anss[i].size()) ans += anss[i][0];
  }
  cout << ans;
  return 0;
}
