#include <bits/stdc++.h>
using namespace std;
const int N = 35;
char grid[N][N];
string l;
vector<pair<double, double>> centers[N];
vector<pair<double, double>> shiftcenters;
int mem[N];
int n, m, x, q;
string s;
int main() {
  memset(mem, -1, sizeof mem);
  scanf("%d %d %d", &n, &m, &x);
  for (int i = 0; i < n; i++) {
    scanf("%s", &grid[i]);
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == 'S')
        shiftcenters.push_back({0.5 + j, 0.5 + i});
      else
        centers[grid[i][j] - 'a'].push_back({0.5 + j, 0.5 + i});
    }
  }
  int q;
  scanf("%d", &q);
  cin >> l;
  int noshift = shiftcenters.size();
  int res = 0;
  for (int i = 0; i < q; i++) {
    if (!centers[tolower(l[i]) - 'a'].size()) {
      puts("-1");
      return 0;
    } else if (islower(l[i]))
      continue;
    else if (isupper(l[i]) && !noshift) {
      puts("-1");
      return 0;
    } else if (isupper(l[i]) && mem[tolower(l[i]) - 'a'] == -1) {
      int idx = tolower(l[i]) - 'a';
      double mndist = 1e6 + 6;
      int sz = centers[idx].size();
      for (int j = 0; j < sz; j++)
        for (int k = 0; k < noshift; k++)
          mndist = min(mndist,
                       hypot(centers[idx][j].first - shiftcenters[k].first,
                             centers[idx][j].second - shiftcenters[k].second));
      if (mndist > x) {
        mem[tolower(l[i]) - 'a'] = 1;
      } else
        mem[tolower(l[i]) - 'a'] = 0;
    }
    res += mem[tolower(l[i]) - 'a'];
  }
  cout << res << endl;
}
