#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
const int mod = 1e9 + 7;
const long long oo = 0x3f3f3f3f;
const int nn = 1e2 + 15;
vector<pair<int, int>> gr[nn], shifts;
map<char, int> vis;
long long get_distance(pair<int, int> a, pair<int, int> b) {
  return ((a.first - b.first) * 1LL * (a.first - b.first) +
          (a.second - b.second) * (a.second - b.second));
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  int n, m, x;
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      if (c == 'S')
        shifts.push_back(make_pair(i, j));
      else
        gr[c - 'a'].push_back(make_pair(i, j));
    }
  }
  int len;
  cin >> len;
  string s;
  cin >> s;
  int res = 0;
  for (int i = 0; i < len; i++) {
    if (isupper(s[i])) {
      s[i] = tolower(s[i]);
      if (!((int)((gr[s[i] - 'a']).size())) || !((int)((shifts).size())))
        return cout << -1, 0;
      else {
        if (vis[s[i]]) {
          if (vis[s[i]] > x * x) res++;
          continue;
        }
        int mn = oo;
        for (int j = 0; j < ((int)((shifts).size())); j++) {
          for (int k = 0; k < ((int)((gr[s[i] - 'a']).size())); k++) {
            int dist = get_distance(shifts[j], gr[s[i] - 'a'][k]);
            mn = min(mn, dist);
          }
        }
        if (mn > x * x) res++;
        vis[s[i]] = mn;
      }
    } else {
      if (!((int)((gr[s[i] - 'a']).size()))) return cout << -1, 0;
    }
  }
  cout << res;
}
