#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Data{
public:
    int y, x, d;
    Data(int y0, int x0, int d0){
        y = y0;
        x = x0;
        d = d0;
    }
};

int dy[] = {0, 1, 0, -1};
int dx[] = {1, 0, -1, 0};

int main()
{
    for(;;){
        int h, w, cost;
        cin >> h >> w >> cost;
        if(h == 0)
            return 0;

        vector<vector<int> > grid(2*h+1, vector<int>(2*w+1, 0));
        for(int i=0; i<2*h+1; ++i)
            grid[i][0] = grid[i][2*w] = -1;
        for(int i=0; i<2*w+1; ++i)
            grid[0][i] = grid[2*h][i] = -1;

        int ns;
        cin >> ns;
        for(int i=0; i<ns; ++i){
            char y, c;
            int x, k;
            cin >> y >> c >> x >> k;
            grid[2*(y-'a')+1][2*(x-1)+1] = k;
        }

        int nc;
        cin >> nc;
        for(int i=0; i<nc; ++i){
            char y1, y2, c;
            int x1, x2;
            cin >> y1 >> c >> x1 >> y2 >> c >> x2;
            grid[y1-'a'+y2-'a'+1][x1+x2-1] = -1;
        }

        int nj;
        cin >> nj;
        for(int i=0; i<nj; ++i){
            char y1, y2, c;
            int x1, x2, d;
            cin >> y1 >> c >> x1 >> y2 >> c >> x2 >> d;
            grid[y1-'a'+y2-'a'+1][x1+x2-1] = d;
        }

        int sy, sx, gy, gx;
        char c, c1, c2;
        cin >> c1 >> c >> sx >> c2 >> c >> gx;
        sy = 2 * (c1 - 'a') + 1;
        gy = 2 * (c2 - 'a') + 1;
        sx = 2 * (sx - 1) + 1;
        gx = 2 * (gx - 1) + 1;

        vector<vector<vector<vector<bool> > > > check(2*h+1, vector<vector<vector<bool> > >(2*w+1, vector<vector<bool> >(4, vector<bool>(101, false))));
        multimap<int, Data> mm;
        for(int i=0; i<4; ++i){
            check[sy][sx][i][0] = true;
            mm.insert(make_pair(0, Data(sy, sx, i)));
        }

        for(;;){
            int t = mm.begin()->first;
            Data d = mm.begin()->second;
            mm.erase(mm.begin());
            if(grid[d.y][d.x] > 0 && !((t / grid[d.y][d.x] % 2 == 0) ^ (d.d % 2 == 0)))
                continue;
            if(d.y == gy && d.x == gx){
                cout << t << endl;
                break;
            }

            for(int i=0; i<4; ++i){
                if((i+2)%4 == d.d)
                    continue;
                int y = d.y + dy[i];
                int x = d.x + dx[i];
                if(grid[y][x] == -1)
                    continue;
                int t1 = t + cost + grid[y][x];
                y += dy[i];
                x += dx[i];
                if(t1 <= 100 && !check[y][x][i][t1]){
                    check[y][x][i][t1] = true;
                    mm.insert(make_pair(t1, Data(y, x, i)));
                }
            }
        }
    }
}