#include <bits/stdc++.h>
using namespace std;
int main() {
  char matrix[30][30]{};
  int n, m, q;
  double d;
  cin >> n >> m >> d;
  vector<pair<int, int> > p;
  string f = "qwertyuiopasdfghjklzxcvbnm", g = "QWERTYUIOPASDFGHJKLZXCVBNM", t;
  for (int y = 0; y < n; y++) {
    string x;
    cin >> x;
    stringstream ss(x);
    for (int x = 0; x < m; x++) {
      ss >> matrix[x][y];
      if (matrix[x][y] == 'S')
        p.push_back(make_pair(x, y));
      else
        f.erase(remove(f.begin(), f.end(), matrix[x][y]), f.end());
    }
  }
  cin >> q >> t;
  if (p.size() == 0 && count_if(t.begin(), t.end(), [](unsigned char ch) {
                         return isupper(ch);
                       }) != 0) {
    cout << "-1";
    return 0;
  }
  for (int i = 0; i < f.size(); i++)
    if (t.find(f[i]) != string::npos || t.find(toupper(f[i])) != string::npos) {
      cout << "-1";
      return 0;
    }
  for (int y = 0; y < n; y++)
    for (int x = 0; x < m; x++)
      if (matrix[x][y] != 'S')
        for (int i = 0; i < p.size(); i++) {
          double e = sqrt(pow(x - p[i].first, 2) + pow(y - p[i].second, 2));
          if (e <= d)
            g.erase(remove(g.begin(), g.end(), toupper(matrix[x][y])), g.end());
        }
  int o = 0;
  for (int i = 0; i < g.size(); i++) o += count(t.begin(), t.end(), g[i]);
  cout << o;
}
