#include <bits/stdc++.h>
using namespace std;
int n, m, ex, q;
string keys[100];
map<char, bool> ready;
map<char, int> result;
double dist(int a, int b, int c, int d) {
  int h;
  if (a == c)
    h = 0;
  else
    h = 1 + max(a, c) - min(a, c) - 1;
  int br;
  if (b == d)
    br = 0;
  else
    br = 1 + max(b, d) - min(b, d) - 1;
  return sqrt(br * br + h * h);
}
int possible(char a) {
  if (ready[a]) return result[a];
  if (a >= 97 && a <= 122) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (keys[i][j] == a) {
          ready[a] = 1;
          result[a] = 1;
          return result[a];
        }
      }
    }
    ready[a] = 1;
    result[a] = 0;
    return result[a];
  }
  bool t = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (keys[i][j] == tolower(a)) {
        for (int x = 0; x < n; x++) {
          for (int y = 0; y < m; y++) {
            if (keys[x][y] == 'S') {
              t = 1;
              if (dist(x, y, i, j) <= ex) {
                ready[a] = 1;
                result[a] = 1;
                return result[a];
              }
            }
          }
        }
      }
    }
  }
  ready[a] = 1;
  if (t == 0) {
    result[a] = 0;
  } else
    result[a] = 2;
  return result[a];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> ex;
  for (int i = 0; i < n; i++) {
    cin >> keys[i];
  }
  cin >> q;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < q; i++) {
    int res = possible(s[i]);
    switch (res) {
      case 0:
        cout << -1;
        return 0;
      case 1:
        continue;
      case 2:
        ans++;
        continue;
    }
  }
  cout << ans;
}
