#include <bits/stdc++.h>
using namespace std;
long long fix(long long cur, long long m) { return ((cur % m) + m) % m; }
long long fast_power(long long x, long long y) {
  if (y == 0) return 1;
  long long temp = fast_power(x, y / 2);
  temp = (temp * temp);
  if (y % 2 != 0) temp = temp * x;
  return temp;
}
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  char arr[n][m];
  vector<pair<int, int> > grid[30];
  bool vis[30] = {false};
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      if (arr[i][j] == 'S')
        v.push_back({i, j});
      else {
        vis[arr[i][j] - 'a'] = true;
        grid[arr[i][j] - 'a'].push_back({i, j});
      }
    }
  }
  int s;
  string str;
  cin >> s >> str;
  int freq[30] = {0};
  bool flag = false;
  for (int i = 0; i < str.size(); i++) {
    if (isupper(str[i])) {
      freq[str[i] - 'A']++;
      flag = true;
    } else {
      if (!vis[str[i] - 'a']) return cout << -1 << "\n", 0;
    }
  }
  if ((!v.size() && flag)) return cout << -1 << "\n", 0;
  int cnt = 0;
  for (int i = 0; i <= 26; i++) {
    char cur = i;
    if (freq[cur]) {
      if (!grid[cur].size()) return cout << -1 << "\n", 0;
      double mini = INT_MAX;
      for (int f = 0; f < grid[cur].size(); f++) {
        pair<int, int> pos = grid[cur][f];
        for (int j = 0; j < v.size(); j++) {
          double des = (v[j].first - pos.first) * (v[j].first - pos.first) +
                       (v[j].second - pos.second) * (v[j].second - pos.second);
          des = sqrt(des);
          mini = min(mini, des);
        }
      }
      if (mini > x) cnt += freq[cur];
    }
  }
  cout << cnt << "\n";
  return 0;
}
