#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
char ar[1000][1000];
vector<pair<int, int> > shifts;
int n, m, xx;
map<char, int> store;
void solve() {
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (1); j < (m + 1); ++j) {
      int dis = INT_MAX;
      int sz = shifts.size();
      for (int k = (0); k < (sz); ++k) {
        int x = shifts[k].first - i;
        int y = shifts[k].second - j;
        if (x * x + y * y <= xx * xx) dis = min(dis, x * x + y * y);
      }
      store[ar[i][j]] = min(store[ar[i][j]], dis);
    }
  }
}
int main() {
  scanf("%d", &(n));
  scanf("%d", &(m));
  scanf("%d", &(xx));
  getchar();
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (1); j < (m + 1); ++j) {
      char c = getchar();
      if (c != 'S') store[c] = INT_MAX;
      ar[i][j] = c;
    }
    getchar();
  }
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (1); j < (m + 1); ++j) {
      if (ar[i][j] == 'S') shifts.push_back(pair<int, int>(i, j));
    }
  }
  solve();
  int q;
  scanf("%d", &(q));
  string query;
  cin >> query;
  int ans = 0;
  for (int i = (0); i < (q); ++i) {
    char c = query[i];
    char cc = tolower(c);
    if (store.find(cc) == store.end()) {
      cout << -1;
      return 0;
    }
    if (isupper(c)) {
      if (shifts.size() > 0) {
        if (store[cc] == INT_MAX) ans++;
      } else {
        cout << -1;
        return 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
