#include <bits/stdc++.h>
using namespace std;
string to_string(char s) { return string(1, s); }
string to_string(string s) { return "\"" + s + "\""; }
template <typename T>
string to_string(vector<T>);
template <typename U, typename V>
string to_string(pair<U, V> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(vector<T> v) {
  string res = "[";
  for (int i = 0; i < (int)v.size() - 1; i++) res += to_string(v[i]) + ", ";
  if (!v.empty()) res += to_string(v.back());
  res += "]";
  return res;
}
int n, m, xs, qsz;
bool poss(double x, double y, double xx, double yy) {
  double z = (x - xx) * (x - xx) + (y - yy) * (y - yy);
  z = sqrt(z);
  if (z <= xs) return true;
  return false;
}
char keyb[35][35];
char q[500100];
vector<pair<int, int> > Shifts;
map<char, int> keyp;
int main() {
  scanf("%d %d %d", &n, &m, &xs);
  for (int i = 0; i < n; i++) {
    scanf("%s", &keyb[i]);
    for (int j = 0; j < m; j++)
      if (keyb[i][j] == 'S') Shifts.push_back(pair<int, int>(i, j));
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (keyb[i][j] != 'S') {
        keyp[keyb[i][j]] = 1;
        for (int k = 0; k < (int)Shifts.size(); k++) {
          if (poss(i, j, Shifts[k].first, Shifts[k].second))
            keyp[keyb[i][j] - 32] = 1;
        }
        if (Shifts.size() && keyp[keyb[i][j] - 32] == 0)
          keyp[keyb[i][j] - 32] = 2;
      }
    }
  scanf("%d", &qsz);
  scanf("%s", q);
  int cnt = 0;
  bool can = true;
  for (int i = 0; i < qsz; i++) {
    if (keyp[q[i]] == 0)
      can = false;
    else if (keyp[q[i]] == 2)
      cnt++;
  }
  if (!can)
    printf("-1\n");
  else
    printf("%d\n", cnt);
}
