#include <bits/stdc++.h>
using namespace std;
const int Max = 35;
int main() {
  int n{}, m{}, x{}, a{}, d{};
  char c[Max][Max], c2{};
  vector<pair<int, int>> v;
  bool b[Max] = {}, p[Max] = {};
  cin >> n >> m >> x;
  for (int i{}; i < n; i++)
    for (int i2{}; i2 < m; i2++) {
      cin >> c[i][i2];
      if (c[i][i2] == 'S')
        v.push_back(make_pair(i, i2));
      else
        b[c[i][i2] - 'a'] = true;
    }
  for (int i{}; i < n; i++)
    for (int i2{}; i2 < m; i2++)
      for (int i3{}; i3 < v.size() && p[c[i][i2] - 'a'] != true; i3++) {
        if (pow(x, 2) >= pow(i - v[i3].first, 2) + pow(i2 - v[i3].second, 2) &&
            c[i][i2] != 'S')
          p[c[i][i2] - 'a'] = true;
      }
  cin >> a;
  while (a--) {
    cin >> c2;
    if (isupper(c2) && !p[c2 - 'A'] && b[c2 - 'A'] && v.size() > 0) d++;
    if (isupper(c2) && !b[c2 - 'A'] || isupper(c2) && v.size() == 0 ||
        islower(c2) && !b[c2 - 'a']) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << d << endl;
  return 0;
}
