#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, x;
  cin >> n >> m >> x;
  char mat[n][m];
  set<char> st;
  bool shift = false;
  vector<pair<long long int, long long int>> cor;
  long long int arr[26];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> mat[i][j];
      st.insert(mat[i][j]);
      if (mat[i][j] == 'S') {
        cor.push_back(make_pair(i, j));
        shift = true;
      }
    }
  }
  long long int sz;
  cin >> sz;
  string s;
  cin >> s;
  long long int count = 0;
  vector<char> v;
  for (long long int i = 0; i < s.length(); i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      auto it = st.find(s[i]);
      if (it == st.end()) {
        cout << "-1\n";
        return 0;
      }
    } else if (s[i] >= 'A' && s[i] <= 'Z') {
      auto it = st.find(tolower(s[i]));
      if (shift == false || it == st.end()) {
        cout << "-1\n";
        return 0;
      }
      v.push_back(tolower(s[i]));
    }
  }
  for (long long int i = 0; i < 26; i++) {
    arr[i] = LLONG_MAX;
  }
  for (long long int i = 0; i < n; i++) {
    pair<long long int, long long int> p;
    for (long long int j = 0; j < m; j++) {
      if (mat[i][j] != 'S') {
        p.first = i;
        p.second = j;
        long long int dis = LLONG_MAX;
        for (auto it : cor) {
          long long int cur_dis =
              (abs(p.first - it.first) * abs(p.first - it.first)) +
              (abs(p.second - it.second) * abs(it.second - p.second));
          dis = min(dis, cur_dis);
        }
        arr[mat[p.first][p.second] - 'a'] =
            min(arr[mat[p.first][p.second] - 'a'], dis);
      }
    }
  }
  for (long long int k = 0; k < v.size(); k++) {
    if (arr[v[k] - 'a'] > (x * x)) {
      count++;
    }
  }
  cout << count << endl;
}
