#include <bits/stdc++.h>
using namespace std;
int main() {
  int c[30] = {};
  int b[30] = {};
  string s[40];
  int n, m, x;
  cin >> n >> m >> x;
  x *= x;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    s[i] = 'a' + s[i];
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] == 'S') {
        for (int r = 1; r <= n; ++r)
          for (int w = 1; w <= m; ++w)
            if (s[r][w] != 'S') {
              int f = (w - j) * (w - j) + (r - i) * (r - i);
              if (!c[s[r][w] - 'a'])
                c[s[r][w] - 'a'] = f;
              else if (c[s[r][w] - 'a'] > f)
                c[s[r][w] - 'a'] = f;
            }
      } else
        b[s[i][j] - 'a'] = 1;
  int sum = 0;
  string d;
  cin >> n;
  cin >> d;
  d = 'a' + d;
  for (int i = 1; i <= n; ++i)
    if (d[i] <= 'z' && d[i] >= 'a') {
      if (b[d[i] - 'a'] == 0) {
        cout << "-1";
        return 0;
      }
    } else {
      if (c[d[i] - 'A'] == 0) {
        cout << "-1";
        return 0;
      } else if (c[d[i] - 'A'] > x)
        sum++;
    }
  cout << sum;
}
