#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, in;
  cin >> n >> m >> x;
  vector<vector<pair<int, int>>> pos;
  vector<pair<int, int>> o;
  for (int i = 0; i < 26; ++i) pos.push_back(o);
  vector<pair<int, int>> shift;
  pair<int, int> temp;
  char c;
  bool has_shift{false}, has_cap{false}, valid{true};
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> c;
      temp = make_pair(i, j);
      if (c == 'S') {
        has_shift = true;
        shift.push_back(temp);
      } else {
        pos.at((int)c - 97).push_back(temp);
      }
    }
  }
  cin >> in;
  char s[in];
  for (int i = 0; i < in; ++i) {
    cin >> c;
    s[i] = c;
    if (c < 95) has_cap = true;
    if (pos.at(tolower(c) - 97).empty()) valid = false;
  }
  if (has_cap && !has_shift) valid = false;
  if (!valid)
    cout << -1 << endl;
  else {
    if (!has_cap)
      cout << 0 << endl;
    else {
      int sum{}, yes[26];
      for (int i = 0; i < 26; ++i) {
        yes[i] = -1;
      }
      double z, tiny;
      for (auto i : s) {
        if (i >= 97) continue;
        i = tolower(i);
        tiny = 100000;
        if (yes[i - 97] == -1) {
          for (auto &sft : shift) {
            for (auto p : pos.at(i - 97)) {
              z = (p.first - sft.first) * (p.first - sft.first) +
                  (p.second - sft.second) * (p.second - sft.second);
              z = sqrt(z);
              if (z < tiny) tiny = z;
            }
          }
          if (tiny > x) {
            sum++;
            yes[i - 97] = 1;
          } else {
            yes[i - 97] = 0;
          }
        } else {
          if (yes[i - 97] == 1) sum++;
        }
      }
      cout << sum << endl;
    }
  }
  return 0;
}
