#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, x;
  cin >> n >> m >> x;
  multimap<char, pair<int, int> > mp;
  vector<pair<int, int> > shift_keys;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      if (c == 'S') {
        shift_keys.push_back(make_pair(i, j));
      } else {
        mp.insert(make_pair(c, make_pair(i, j)));
      }
    }
  }
  int no_of_shift_keys = shift_keys.size();
  map<char, bool> visited;
  int q, cnt = 0;
  cin >> q;
  for (int i = 0; i < q; i++) {
    char c;
    cin >> c;
    bool is_upper = isupper(c);
    c = tolower(c);
    if (mp.count(c) > 0) {
      if (is_upper) {
        if (no_of_shift_keys == 0) {
          cout << "-1\n";
          return 0;
        }
        if (visited.count(c) > 0) {
          if (visited[c] == true) cnt++;
        } else {
          int min_dist = INT_MAX;
          auto itr1 = mp.lower_bound(c);
          auto itr2 = mp.upper_bound(c);
          while (itr1 != itr2) {
            if (itr1->first == c) {
              int x1 = itr1->second.first, y1 = itr1->second.second;
              for (auto key : shift_keys) {
                int a = key.first, b = key.second;
                int d = pow((x1 - a), 2) + pow((y1 - b), 2);
                min_dist = min(min_dist, d);
              }
            }
            itr1++;
          }
          if (min_dist > x * x) {
            visited.insert(make_pair(c, true));
            cnt++;
          } else {
            visited.insert(make_pair(c, false));
          }
        }
      }
    } else {
      cout << "-1\n";
      return 0;
    }
  }
  cout << cnt << endl;
  return 0;
}
