#include <bits/stdc++.h>
using namespace std;
using ll = long long;
double dist(double a, double b, double c, double d) {
  return sqrt((a - c) * (a - c) + (b - d) * (b - d));
}
bool noteq(double a, double b, double esp = 0.000001) {
  return !(fabs(a - b) < esp);
}
void solve() {
  int n, m;
  double x;
  cin >> n >> m >> x;
  bool l[26] = {0};
  double u[26] = {0};
  for (int i = 0; i < (26); ++i) u[i] = 60;
  char mat[n + 1][m + 1];
  bool shift = false;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (m); ++j) {
      cin >> mat[i][j];
      if (mat[i][j] != 'S')
        l[mat[i][j] - 'a'] = 1;
      else if (!shift)
        shift = true;
    }
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (m); ++j) {
      if (mat[i][j] == 'S') continue;
      double diff = u[mat[i][j] - 'a'];
      for (int x = 0; x < (n); ++x) {
        for (int y = 0; y < (m); ++y) {
          if (mat[x][y] == 'S') {
            diff = min(diff, dist(i, j, x, y));
            u[mat[i][j] - 'a'] = diff;
          }
        }
      }
    }
  }
  int ct = 0, len;
  string s;
  cin >> len >> s;
  for (int i = 0; i < (len); ++i) {
    if (s[i] >= 'a' and s[i] <= 'z') {
      if (l[s[i] - 'a'])
        continue;
      else {
        ct = -1;
        break;
      }
    }
    if (s[i] >= 'A' and s[i] <= 'Z') {
      if (!shift or !l[s[i] - 'A']) {
        ct = -1;
        break;
      }
      if (u[s[i] - 'A'] > x) {
        ct++;
      }
    }
  }
  cout << ct;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t = 1;
  while (t--) solve();
  return 0;
}
