#include <bits/stdc++.h>
using namespace std;
int n, m, q;
double x;
vector<int> l(26, 0);
vector<double> u(26, 1e9);
string keys[30];
vector<pair<int, int>> shift;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) {
    cin >> keys[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (keys[i][j] == 'S') {
        shift.push_back({i, j});
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (keys[i][j] == 'S') continue;
      int c = keys[i][j] - 'a';
      l[c] = 1;
      double d = 1e9;
      for (int k = 0; k < (int)shift.size(); k++) {
        double e = abs(shift[k].first - i) * abs(shift[k].first - i) +
                   abs(shift[k].second - j) * abs(shift[k].second - j);
        e = sqrt(e);
        d = min(e, d);
      }
      if (d < 1e9) {
        u[c] = min(u[c], d);
      }
    }
  }
  cin >> q;
  int a = 0;
  for (int i = 0; i < q; i++) {
    char c;
    cin >> c;
    if (isupper(c)) {
      if (u[c - 'A'] == 1e9) {
        cout << -1;
        return 0;
      } else if (u[c - 'A'] > x)
        a++;
    } else {
      if (l[c - 'a'] == 0) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << a;
}
