#include <bits/stdc++.h>
using namespace std;
int n, m, p, q, ans;
char a[40][40];
bool d[256], flag;
string s;
void f(int x, int y) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int t = a[i][j];
      if (a[i][j] != 'S' && ((x - i) * (x - i) + (y - j) * (y - j)) <= p * p &&
          97 <= t)
        d[t - 32] = 1;
    }
}
int main() {
  cin >> n >> m >> p;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < s.size(); j++) a[i][j] = s[j];
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 'S') {
        flag = 1;
        f(i, j);
      } else
        d[a[i][j]] = 1;
  cin >> q >> s;
  for (int i = 0; i < q; i++)
    if (('a' <= s[i] && s[i] <= 'z' && !d[s[i]]) ||
        ('A' <= s[i] && s[i] <= 'Z' && d[s[i]] == 0 &&
         (!flag || !d[s[i] + 32]))) {
      ans = -1;
      break;
    } else if ('A' <= s[i] && s[i] <= 'Z' && !d[s[i]] && flag && d[s[i] + 32])
      ans++;
  cout << ans;
  return 0;
}
