#include <bits/stdc++.h>
using namespace std;
map<char, int> t;
int main() {
  int n, m, x;
  char a[35][35];
  cin >> n >> m >> x;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  int len, ans = 0;
  cin >> len;
  for (int k = 0; k < 52; ++k) {
    char z;
    if (k < 26)
      z = k + 'a';
    else
      z = k - 26 + 'A';
    char z2;
    if (z >= 'A' && z <= 'Z')
      z2 = z - 'A' + 'a';
    else
      z2 = z;
    bool h = false, h2 = false, h3 = false;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (a[i][j] == z2) {
          h2 = true;
          if (z >= 'A' && z <= 'Z') {
            for (int i2 = 0; i2 < n; ++i2) {
              for (int j2 = 0; j2 < m; ++j2) {
                if (a[i2][j2] == 'S') {
                  h3 = true;
                  int d = (i2 - i) * (i2 - i) + (j2 - j) * (j2 - j);
                  if (d <= x * x) h = true;
                }
                if (h) break;
              }
              if (h) break;
            }
          } else {
            h = true;
          }
        }
        if (h) break;
      }
      if (h) break;
    }
    if (h2 == false || (h == false && h3 == false)) {
      t[z] = -1;
    } else {
      t[z] = 0;
      if (h == false) t[z] = 1;
    }
  }
  for (int i = 0; i < len; ++i) {
    char z;
    cin >> z;
    if (t[z] == -1) {
      cout << -1 << endl;
      return 0;
    }
    ans += t[z];
  }
  cout << ans;
  return 0;
}
