#include <bits/stdc++.h>
using namespace std;
const int MAX = 3e1 + 5;
int n, m, x, q;
char grid[MAX][MAX], s[(int)5e5 + 5];
map<char, int> mp;
int frq[(int)5e5 + 5];
int main() {
  scanf("%d %d %d", &n, &m, &x);
  for (int i = 0; i < n; i++) {
    scanf("%s", grid[i]);
  }
  bool sExist = 0;
  scanf("%d", &q);
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == 'S') {
        sExist = 1;
        continue;
      }
      mp[grid[i][j]] = 1;
      for (int k = 0; k < n; k++) {
        for (int l = 0; l < m; l++) {
          if (grid[i][j] != 'S' && grid[k][l] == 'S' &&
              ((i - k) * (i - k) + (j - l) * (j - l)) <= (x * x)) {
            mp[grid[i][j] - 'a' + 'A'] = 1;
          }
        }
      }
    }
  }
  int ans = 0;
  bool flg = 1;
  for (int i = 0; i < q; i++) {
    if ('a' <= s[i] && s[i] <= 'z') {
      flg &= mp.count(s[i]);
    } else {
      flg &= (mp.count(s[i] - 'A' + 'a'));
      if (!mp.count(s[i])) {
        flg &= sExist;
        ans++;
      } else {
        frq[s[i]]++;
      }
    }
  }
  if (flg) {
    printf("%d", ans);
  } else {
    puts("-1");
  }
}
