#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e8;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
int n = 0, m = 0, x = 0, q = 0, r = 0;
char c;
char arr[31][31];
vector<pair<int, int>> vec;
map<char, bool> ma;
map<char, bool> ex;
map<char, bool> vis;
bool valid(int i, int j) {
  if (i < n && i >= 0 && j < m && j >= 0) {
    return 1;
  } else {
    return 0;
  }
}
void dfs(int a, int y, int px, int py, int m) {
  if (valid(a, y) && ((px - a) * (px - a)) + ((py - y) * (py - y)) <= x * x) {
  }
  if (((px - a) * (px - a)) + ((py - y) * (py - y)) > x * x || !valid(a, y) ||
      vis[char(arr[a][y])] == 1) {
  } else {
    vis[char(arr[a][y])] = 1;
    ma[char(arr[a][y] - 32)] = 1;
    m++;
    dfs(a + 1, y, px, py, m);
    dfs(a - 1, y, px, py, m);
    dfs(a, y + 1, px, py, m);
    dfs(a, y - 1, px, py, m);
    dfs(a + 1, y + 1, px, py, m);
    dfs(a - 1, y - 1, px, py, m);
    dfs(a - 1, y + 1, px, py, m);
    dfs(a + 1, y - 1, px, py, m);
  }
}
int main() {
  cin >> n >> m >> x;
  for (int i = 0; i < (int)(n); ++i)
    for (int p = 0; p < (int)(m); ++p) {
      cin >> arr[i][p];
      ex[arr[i][p]] = 1;
      if (arr[i][p] == 'S') {
        vec.push_back(make_pair(i, p));
      }
    }
  for (int i = 0; i < ((int)((vec).size())); ++i)
    for (int z = 0; z < (int)(x); ++z) {
      vis.clear();
      dfs(vec[i].first, vec[i].second, vec[i].first, vec[i].second, 1);
    }
  cin >> q;
  for (int i = 0; i < (int)(q); ++i) {
    cin >> c;
    if (int(c) >= 65 && int(c) <= 90) {
      if (((int)((vec).size())) == 0 || !ex[char(c + 32)]) {
        cout << -1;
        return 0;
      }
      if (!ma[c]) {
        r++;
      }
    } else {
      if (ex[c] == 0) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << r;
  return 0;
}
