#include <bits/stdc++.h>
using namespace std;
int n, m, x, q, y, lim, dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
char gird[50][50], ch;
double dis[50][50];
string s;
map<char, int> mp;
bool isS = false;
bool check(int i, int j) {
  if (i >= 0 and i < n and j >= 0 and j < m and gird[i][j] != 'S') return true;
  return false;
}
int _getval(int i, int j, int r, int c) {
  int xx = abs(i - r);
  int yy = abs(j - c);
  return xx * xx + yy * yy;
}
void bfs(pair<int, int> src) {
  dis[src.first][src.second] = 0;
  queue<pair<int, int> > Q;
  Q.push(src);
  while (!Q.empty()) {
    pair<int, int> u = Q.front();
    Q.pop();
    for (int i = 0; i < 4; i++) {
      x = u.first + dx[i], y = u.second + dy[i];
      int ret = _getval(x, y, src.first, src.second);
      if (check(x, y) and ret < dis[x][y]) {
        dis[x][y] = ret;
        if (dis[x][y] <= lim * lim) {
          ch = toupper(gird[x][y]);
          mp[ch] = 1;
          Q.push({x, y});
        }
      }
    }
  }
}
void pre() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (gird[i][j] == 'S') {
        bfs({i, j});
        isS = true;
      }
    }
  }
}
void solve() {
  int cnt = 0;
  bool flag = false;
  cin >> q >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] >= 'A' and s[i] <= 'Z' and isS) {
      if (!mp[tolower(s[i])])
        flag = true;
      else if (!mp[s[i]])
        cnt++;
    } else if (!mp[s[i]])
      flag = true;
  }
  if (flag)
    cout << -1 << endl;
  else
    cout << cnt << endl;
}
int main() {
  cin >> n >> m >> lim;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> ch;
      gird[i][j] = ch;
      dis[i][j] = 1e9;
      if (ch != 'S') mp[ch] = 1;
    }
  }
  pre();
  solve();
  return 0;
}
