#include <bits/stdc++.h>
using namespace std;
int N, M, X, flag[30], Q;
string T;
map<char, vector<pair<int, int> > > key;
vector<pair<int, int> > shift;
int dist(int x1, int y1, int x2, int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
void init() {
  for (int i = 0; i < 26; i++) {
    char c = 'a' + i;
    if (key[c].empty())
      flag[i] = -1;
    else {
      for (int j = 0; j < key[c].size(); j++)
        for (int k = 0; k < shift.size(); k++)
          if (dist(key[c][j].first, key[c][j].second, shift[k].first,
                   shift[k].second) <= X * X)
            flag[i] = 1;
    }
  }
}
int solve() {
  int ret = 0;
  for (int i = 0; i < Q; i++) {
    if (flag[tolower(T[i]) - 'a'] == -1 || (isupper(T[i]) && shift.empty()))
      return -1;
    if (isupper(T[i])) ret += flag[T[i] - 'A'] != 1;
  }
  return ret;
}
int main() {
  cin >> N >> M >> X;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < M; j++)
      if (s[j] == 'S')
        shift.push_back(make_pair(i, j));
      else
        key[s[j]].push_back(make_pair(i, j));
  }
  init();
  cin >> Q >> T;
  cout << solve() << endl;
  return 0;
}
