#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * power(a * a % md, b / 2, md) % md
                      : power(a * a % md, b / 2, md) % md));
}
const int xn = 1e2 + 10;
const int xm = -20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const long long INF = 1e18 + 10;
const int mod = 998244353;
const int base = 257;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  bool pres = false;
  vector<tuple<int, int>> shift;
  vector<vector<char>> key;
  vector<char> vv;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char a;
      cin >> a;
      if (a == 'S') {
        shift.push_back(make_tuple(i, j));
        a = '.';
        pres = true;
      }
      vv.push_back(a);
    }
    key.push_back(vv);
    vv.clear();
  }
  int q, cnt = 0;
  string s;
  cin >> q >> s;
  shift.push_back(make_tuple(333, 333));
  vector<tuple<char, long long>> v;
  x = x * x;
  long long x1, y1;
  long long dist;
  vector<char> good;
  vector<char> bad;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < int(shift.size()); k++) {
        x1 = abs(get<0>(shift[k]) - i);
        y1 = abs(get<1>(shift[k]) - j);
        dist = min(x1 * x1 + y1 * y1, dist);
      }
      if (dist > x) {
        bad.push_back(key[i][j]);
      } else {
        good.push_back(key[i][j]);
      }
      dist = 33333333;
    }
  }
  for (int i = 0; i < q; i++) {
    if (find(good.begin(), good.end(), tolower(s[i])) == good.end() &&
        find(bad.begin(), bad.end(), tolower(s[i])) == bad.end()) {
      cout << -1 << '\n';
      return 0;
    }
    if (isupper(s[i])) {
      if (!(find(good.begin(), good.end(), tolower(s[i])) != good.end())) {
        cnt++;
      }
      if (!pres) {
        cout << -1 << '\n';
        return 0;
      }
    }
  }
  cout << cnt << '\n';
  return 0;
}
