#include <bits/stdc++.h>
using namespace std;
void Code_Crush() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
double Dist(int x1, int y1, int x2, int y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  Code_Crush();
  int n, m, dist;
  cin >> n >> m >> dist;
  vector<pair<int, int>> Shift;
  map<char, double> mp;
  char key[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> key[i][j];
      if (key[i][j] == 'S') Shift.push_back({i, j});
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      double Min = INT_MAX;
      if (key[i][j] != 'S') {
        for (int k = 0; k < Shift.size(); k++) {
          double d = Dist(i, j, Shift[k].first, Shift[k].second);
          Min = min(Min, d);
        }
        if (!mp[key[i][j]]) mp[key[i][j]] = INT_MAX;
        mp[key[i][j]] = min(Min, mp[key[i][j]]);
      }
    }
  }
  int q;
  string s;
  cin >> q >> s;
  int min_count = 0;
  for (int i = 0; i < s.size(); i++) {
    if (!mp[tolower(s[i])]) return cout << -1, 0;
    if (s[i] >= 'A' && s[i] <= 'Z') {
      if (!Shift.size()) return cout << -1, 0;
      if (mp[tolower(s[i])] > dist) min_count++;
    }
  }
  cout << min_count << "\n";
  return 0;
}
