#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printList(vector<T> text) {
  for (const auto &value : text) cout << value << " ";
  cout << '\n';
}
int get_dist(pair<int, int> p1, pair<int, int> p2) {
  return (p1.first - p2.first) * (p1.first - p2.first) +
         (p1.second - p2.second) * (p1.second - p2.second);
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, x;
  string temp;
  cin >> n >> m >> x;
  vector<vector<pair<int, int> > > letter_coords(256);
  vector<pair<int, int> > shift_symbols;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    for (int j = 0; j < m; ++j) {
      if (temp[j] != 'S') {
        letter_coords[temp[j]].push_back({i, j});
      } else {
        shift_symbols.push_back({i, j});
      }
    }
  }
  bool shift_exist = !shift_symbols.empty();
  int len_q;
  cin >> len_q;
  string q;
  cin >> q;
  for (char letter : q) {
    if ('A' <= letter && letter <= 'Z') {
      if (!shift_exist) {
        cout << "-1\n";
        return 0;
      }
    }
  }
  int res(0);
  bool add(false);
  vector<int> dp(256, -1);
  for (char letter : q) {
    if (letter_coords[tolower(letter)].empty()) {
      res = -1;
      break;
    }
    if (isupper(letter)) {
      if (dp[letter] != -1) {
        res += dp[letter];
      } else {
        add = true;
        for (pair<int, int> letter_pos : letter_coords[tolower(letter)]) {
          if (!add) break;
          for (pair<int, int> shift : shift_symbols) {
            if (get_dist(letter_pos, shift) <= x * x) {
              add = false;
              break;
            }
          }
        }
        dp[letter] = add;
        res += add;
      }
    }
  }
  cout << res << '\n';
  return 0;
}
