#include <bits/stdc++.h>
using namespace std;
int n, m, x, q, y, lim;
char gird[50][50], ch;
string s;
map<char, int> mp;
bool isS = false;
void pre() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (gird[i][j] == 'S') {
        isS = true;
        for (int k = 0; k < n; k++)
          for (int l = 0; l < m; l++)
            if (gird[k][l] != 'S')
              if (abs(i - k) * abs(i - k) + abs(j - l) * abs(j - l) <=
                  lim * lim)
                mp[toupper(gird[k][l])] = 1;
      }
}
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;
      if (ch != 'S') mp[ch] = 1;
    }
  }
  pre();
  solve();
  return 0;
}
