#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const long long mod = 998244353;
int dx[] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
const int N = 500001;
void stop() {}
struct point {
  double x, y;
};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long fixMod(long long a, long long b) { return ((a % b) + b) % b; }
double triangle_area(int x1, int y1, int x2, int y2, int x3, int y3) {
  return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)) / 2.;
};
long long dis(point a, point b) {
  long long x = a.x - b.x, y = a.y - b.y;
  return x * x + y * y;
}
double traingleArea(double a, double b, double c) {
  double s = (a + b + c) / 2.0;
  return sqrt(s * (s - a) * (s - b) * (s - c));
}
double circleArea(double r) { return acos(-1) * r * r; }
long long power(long long x, long long y) {
  if (y == 0) return 1;
  if (y == 1) return x;
  long long r = power(x, y / 2) % mod;
  return r % mod * r % mod * power(x, y % 2) % mod;
}
vector<pair<long long, long long>> vis[26], second;
int mem[26];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int x;
  char arr1[30][30];
  cin >> x;
  char ch;
  int arr[26] = {0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> ch;
      if (ch == 'S')
        second.push_back({i + 1, j + 1});
      else
        vis[ch - 'a'].push_back({i + 1, j + 1});
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < vis[i].size() && !mem[i]; j++) {
      long long x1, y1, x2, y2;
      long long dis;
      x1 = vis[i][j].first, y1 = vis[i][j].second;
      for (int k = 0; k < second.size() && !mem[i]; k++) {
        x2 = second[k].first, y2 = second[k].second;
        dis = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
        if (dis <= x * x) mem[i] = 1;
      }
    }
  }
  int t, ans = 0;
  cin >> t;
  char c;
  while (t--) {
    cin >> c;
    if (islower(c)) {
      if (vis[c - 'a'].size() == 0) {
        cout << "-1";
        return 0;
      } else
        continue;
    }
    c = tolower(c);
    if (vis[c - 'a'].size() == 0 || second.size() == 0) {
      cout << "-1";
      return 0;
    }
    if (!mem[c - 'a']) ans++;
  }
  cout << ans;
  return 0;
}
