#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int n, m, x, sz, arch[300];
vector<pair<int, int>> sh, p[300];
char s[N];
bool c[300];
vector<string> v;
int main() {
  scanf("%d %d %d", &n, &m, &x);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    v.push_back(s);
    for (int j = 0; j < m; j++) {
      if (s[j] == 'S')
        sh.push_back({i, j}), c[s[j]] = 1;
      else {
        p[s[j]].push_back({i, j});
        c[s[j]] = 1;
      }
    }
  }
  scanf("%d \n%s", &sz, s);
  int cnt = 0;
  for (int i = 0; i < sz; i++) {
    if (!c[tolower(s[i])]) return 0 * puts("-1");
    if (s[i] == 'S' && (!c['s'])) return 0 * puts("-1");
    if (s[i] < 'a' && (!c['S'])) return 0 * puts("-1");
    if (s[i] < 'a') {
      if (arch[s[i]] != 0) {
        cnt += arch[s[i]];
        continue;
      }
      int ans = numeric_limits<int>::max();
      for (auto z : sh) {
        for (auto q : p[tolower(s[i])]) {
          int xx = q.first - z.first, yy = q.second - z.second;
          int res = (xx * xx + yy * yy);
          ans = min(ans, res);
        }
      }
      if (ans > x * x) cnt++, arch[s[i]] = 1;
    }
  }
  printf("%d", cnt);
  return 0;
}
