#include <bits/stdc++.h>
using namespace std;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
const int N = 33;
int n, m, x, idx;
char grid[N][N];
map<char, bool> mp, mem;
pair<int, int> s[N * N];
string q;
bool cmp(double x, double y) {
  if (abs(x - y) <= 1e-9) return 1;
  if (x < y) return 1;
  return 0;
}
bool check(int a, int b) {
  for (int i = 0; i < idx; i++) {
    double dis = sqrt(pow(a - s[i].first, 2.0) + pow(b - s[i].second, 2.0));
    if (cmp(dis, x)) {
      return 1;
    }
  }
  return 0;
}
int main() {
  file();
  fast();
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> grid[i][j];
      if (grid[i][j] == 'S')
        s[idx++] = {i, j};
      else
        mp[grid[i][j]] = 1;
    }
  bool flag = idx > 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == 'S') continue;
      if (mem[grid[i][j]]) continue;
      mem[grid[i][j]] = check(i, j);
    }
  }
  int w;
  cin >> w;
  cin >> q;
  int ans = 0;
  for (auto ch : q) {
    if ((int)(ch) >= 97) {
      if (!mp[ch]) return cout << -1 << "\n", 0;
    } else {
      if (!mp[ch + 32]) return cout << -1 << "\n", 0;
      if (!flag) return cout << -1 << "\n", 0;
      if (!mem[ch + 32]) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
