#include <bits/stdc++.h>
using namespace std;
void File_input() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
void FastInputOutput() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = 70;
const int E = 5e5 + 7;
bool alpha['z' + 1];
int vst['z' + 1];
int n, m, x, len, ans;
char keybord[N][N];
string str;
int pos[E];
vector<vector<int> > keyx('z' + 1), keyy('z' + 1);
int dist(int x1, int y1, int x2, int y2) {
  return pow(x1 - x2, 2) + pow(y1 - y2, 2);
}
int main() {
  FastInputOutput();
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> keybord[i][j];
      alpha[keybord[i][j]] = 1;
      keyx[keybord[i][j]].push_back(i);
      keyy[keybord[i][j]].push_back(j);
    }
  cin >> len;
  cin >> str;
  for (char t = 'a'; t <= 'z'; t++) {
    int x1, x2, y1, y2, mn = 1e9;
    x1 = x2 = y1 = y2 = -1;
    for (int j = 0; j < keyx[t].size(); j++) {
      for (int m = 0; m < keyx['S'].size(); m++) {
        x1 = keyx[t][j] + 1;
        y1 = keyy[t][j] + 1;
        x2 = keyx['S'][m] + 1;
        y2 = keyy['S'][m] + 1;
        mn = min(mn, dist(x1, y1, x2, y2));
      }
    }
    vst[t] = mn;
  }
  for (int i = 0; i < len; i++) {
    if (((!alpha[tolower(str[i])]) ||
         (isupper(str[i]) && (!alpha[tolower(str[i])] || keyx['S'].empty())))) {
      cout << -1;
      return 0;
    }
    if (isupper(str[i])) {
      pos[i] = vst[tolower(str[i])];
    }
  }
  for (int i = 0; i < len; i++)
    if (pos[i] > x * x) ans++;
  cout << ans;
  return 0;
}
