#include <bits/stdc++.h>
using namespace std;
unordered_map<char, int> mark;
vector<pair<long long, long long> > v;
double mini(double a, double b) {
  if (a >= b)
    return b;
  else
    return a;
}
int check(long long x, long long y, double mdis) {
  double dis = double(1e9);
  for (long long i = 0; i < int(v.size()); i++) {
    long long t1 = (v[i].first - x);
    long long t2 = v[i].second - y;
    double d = sqrt(t1 * t1 + t2 * t2);
    if (d <= mdis) return -1;
  }
  return 1;
}
char convert(char c) {
  if (c >= 'A' && c <= 'Z') return tolower(c);
  if (c >= 'a' && c <= 'z') return toupper(c);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  double x;
  cin >> n >> m;
  cin >> x;
  char arr[n + 1][m + 1];
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 'S')
        v.push_back({i, j});
      else
        mark[arr[i][j]] = 1;
    }
  }
  unordered_map<char, double> dis;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      if (arr[i][j] >= 'a' && arr[i][j] <= 'z') {
        if (dis[arr[i][j]] == -1) continue;
        dis[arr[i][j]] = check(i, j, x);
      }
    }
  }
  long long q;
  cin >> q;
  string s;
  cin >> s;
  long long ans = 0;
  for (long long i = 0; i < int(s.size()); i++) {
    if (mark[s[i]] != 1 && s[i] >= 'A' && s[i] <= 'Z' &&
        mark[convert(s[i])] == 1 && int(v.size()) != 0) {
      if (dis[convert(s[i])] == 1) ans++;
    } else if (mark[s[i]] == 1)
      continue;
    else {
      cout << "-1" << endl;
      exit(0);
    }
  }
  cout << ans << endl;
  return 0;
}
