#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}


#define int long long
void solve(){
    vector<int> final_ans;
    while (true) {
        int n, m, h, k;
        cin >> n >> m >> h >> k;
        if (n == 0) {
            REP(i, final_ans.size()) if (final_ans[i] == 1e9) final_ans[i] = -1;
            REP(i, final_ans.size()) cout << final_ans[i] << endl;
            return;
        }
        vector<tuple<int, int, int, int, int>> edges;
        REP(i, m) {
            int a, b, c, d, e;
            cin >> a >> b >> c >> d >> e;
            edges.push_back(make_tuple(a, b, c, d, e));
        }
        int s, t;
        cin >> s >> t;
        int p;
        cin >> p;
        vector<int> dp((1 << k), 1e9);
        dp[0] = 0;
        REP(i, p) {
            int a, b;
            cin >> a >> b;
            int hoge = 0;
            REP(q, a) {
                int c;
                cin >> c;
                c--;
                hoge += 1 << c;
            }
            REP(q, (1 << k)) {
                dp[q | hoge] = min(dp[q | hoge], dp[q] + b);
            }
        }
        int ans = 1e9;
        REP(i, (1 << k)) {
            vector<tuple<int,int,int>> vertexs[200];
            REP(q, m) {
                pair<int, int> cost = mp(get<2>(edges[q]),get<3>(edges[q]));
                if ((1 << (get<4>(edges[q]) - 1))& i) {
                    cost.first = 0;
                }
                vertexs[get<0>(edges[q])].push_back(make_tuple(get<1>(edges[q]), cost.first, cost.second));
                vertexs[get<1>(edges[q])].push_back(make_tuple(get<0>(edges[q]), cost.first, cost.second));
            }
            int dist[25][101];
            REP(q, 25) {
                REP(i, 101) {
                    dist[q][i] = 1e9;
                }
            }
            dist[0][s] = 0;
            priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<tuple<int, int, int>>> next;
            next.push(make_tuple(0, 0, s));
            while (next.empty() == false) {
                tuple<int, int, int> now = next.top();
                next.pop();
                if (get<0>(now) != dist[get<1>(now)][get<2>(now)]) continue;
                for (auto x : vertexs[get<2>(now)]) {
                    int hour = get<2>(x) + get<1>(now);
                    if (hour > h) continue;
                    int cost = get<1>(x) + get<0>(now);
                    if (dist[hour][get<0>(x)] > cost) {
                        dist[hour][get<0>(x)] = cost;
                        next.push(make_tuple(cost, hour, get<0>(x)));
                    }
                }
            }
            REP(q, h + 1) {
                ans = min(ans, dist[q][t] + dp[i]);
            }
        }
        final_ans.push_back(ans);
    }
}

#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 3392