#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int INF = 1 << 28;
inline pair<int, int> inputPos(){
	string str;
	cin >> str;
	return pair<int, int>(str[0] - 'a', atoi(str.c_str() + 2) - 1);
}

int m, n;
int D;
int sign[20][20];
int cant[20][20][20][20];
int cst[20][20][20][20];
pair<int, int> sp, gp;

bool ok(int x, int y){
	return x >= 0 && x < m && y >= 0 && y < n;
}

void solve()
{
	typedef tuple<int, int, int, int> Tp;
	
	static int dist[20][20][4];
	fill_n(**dist, 20 * 20 * 4, INF);
	
	priority_queue<Tp, vector<Tp>, greater<Tp>> pq;
	
	dist[sp.first][sp.second][3] = 0;
	pq.push(Tp(0, sp.first, sp.second, 3));
	
	while (pq.size()){
		Tp tp = pq.top(); pq.pop();
		int sum, x, y, d;
		tie(sum, x, y, d) = tp;
		if (dist[x][y][d] < sum) continue;
		for (int i = 3; i <= 5; i++){
			int dir = (d + i) % 4;
			int nx = x + dx[dir];
			int ny = y + dy[dir];
			if (!ok(nx, ny)) continue;
			if (cant[x][y][nx][ny]) continue;
			int ns = sum + D + cst[x][y][nx][ny];
			if (sign[nx][ny]){
				if ((ns / sign[nx][ny] + dir) % 2 == 1){
					continue;
				}
			}
			if (dist[nx][ny][dir] > ns){
				dist[nx][ny][dir] = ns;
				pq.push(Tp(ns, nx, ny, dir));
			}
		}
	}
	
	int res = 114514;
	for (int i = 0; i < 4; i++){
		res = min(res, dist[gp.first][gp.second][i]);
	}
	printf("%d\n", res);
}

int main()
{
	while (scanf("%d %d", &m, &n), m){
		memset(sign, 0, sizeof(sign));
		memset(cant, 0, sizeof(cant));
		memset(cst, 0, sizeof(cst));
		
		scanf("%d", &D);
		
		int ns;
		scanf("%d", &ns);
		for (int i = 0; i < ns; i++){
			pair<int, int> pos = inputPos();
			int k;
			scanf("%d", &k);
			sign[pos.first][pos.second] = k;
		}
		
		int nc;
		scanf("%d", &nc);
		for (int i = 0; i < nc; i++){
			pair<int, int> pos1 = inputPos();
			pair<int, int> pos2 = inputPos();
			cant[pos1.first][pos1.second][pos2.first][pos2.second] = true;
			cant[pos2.first][pos2.second][pos1.first][pos1.second] = true;
		}
		
		int nj;
		scanf("%d", &nj);
		for (int i = 0; i < nj; i++){
			pair<int, int> pos1 = inputPos();
			pair<int, int> pos2 = inputPos();
			int d;
			scanf("%d", &d);
			cst[pos1.first][pos1.second][pos2.first][pos2.second] += d;
			cst[pos2.first][pos2.second][pos1.first][pos1.second] += d;
		}
		
		sp = inputPos();
		gp = inputPos();
		
		solve();
	}
}