#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 42;
int main() {
  long long n, m, x;
  cin >> n >> m >> x;
  vector<string> v(n);
  vector<pair<float, float>> shifts;
  map<char, int> mp;
  for (int i = 'A'; i <= 'Z'; i++) {
    mp.insert({i, INF});
  }
  for (int i = 'a'; i <= 'z'; i++) {
    mp.insert({i, INF});
  }
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    for (int j = 0; j < m; j++) {
      if (v[i][j] == 'S')
        shifts.push_back({i, j});
      else
        mp[v[i][j]] = 0;
    }
  }
  for (auto s : shifts) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (v[i][j] != 'S') {
          int dist = ceil(sqrt((s.first - i) * (s.first - i) +
                               (s.second - j) * (s.second - j)));
          mp[toupper(v[i][j])] = min(mp[toupper(v[i][j])], dist);
        }
      }
    }
  }
  int sz, ans = 0;
  ;
  cin >> sz;
  string test;
  cin >> test;
  for (auto i : test) {
    if (mp[i] == INF) {
      cout << "-1\n";
      exit(0);
    } else if (mp[i] <= x)
      continue;
    else
      ans++;
  }
  cout << ans << "\n";
  return 0;
}
