#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
struct edge {
    int c, h, r, to;
    edge(int _to, int _c, int _h, int _r) {
        to = _to;
        c = _c;
        h = _h;
        r = _r;
    }
};

struct query {
    int n, h, cost;
    query(int _n, int _h, int _cost) {
        n = _n;
        h = _h;
        cost = _cost;
    }
};

bool operator> (query a, query b) {
    return a.cost > b.cost;
}

int N, M, H, K;
int S, T;
int P;
int passport[1<<8];
vector<edge> paths[100];
int dist[100][25];

int f(int Free) {
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= H; j++) dist[i][j] = 1e9;
    }
    dist[S][0] = 0;
    priority_queue<query, vector<query>, greater<query>> que;
    que.emplace(S, 0, 0);
    while(!que.empty()) {
        query now = que.top();
        que.pop();
        for(auto e : paths[now.n]) {
            int newh = now.h + e.h;
            int newcost = now.cost;
            if(!(Free & (1 << e.r))) {
                newcost += e.c;
            }
            if(newh > H) continue;
            int to = e.to;
            if(chmin(dist[to][newh], newcost)) {
                que.emplace(to, newh, newcost);
            }
        }
    }
    int ans = 1e9;
    for(int i = 0; i <= H; i++) {
        chmin(ans, dist[T][i]);
    }
    //cerr << Free << " " << ans << endl;
    return ans;
}

void solve() {
    for(int i = 0; i < N; i++) paths[i].clear();
    for(int i = 0; i < (1 << K); i++) passport[i] = 1e9;
    for(int i = 0; i < M; i++) {
        int a, b, c, h, r;
        cin >> a >> b >> c >> h >> r;
        a--;
        b--;
        r--;
        paths[a].push_back(edge(b, c, h, r));
        paths[b].push_back(edge(a, c, h, r));
    }
    cin >> S >> T;
    S--;
    T--;
    cin >> P;
    for(int i = 0; i < P; i++) {
        int bits = 0;
        int d = 0;
        int l = 0;
        cin >> l >> d;
        while(l--) {
            int k;
            cin >> k;
            k--;
            bits |= (1 << k);
        }
        passport[bits] = d;
    }
    passport[0] = 0;
    for(int bits = (1 << K) - 1; bits >= 0; bits--) {
        for(int i = 0; i < K; i++) {
            if(bits & (1 << i)) continue;
            chmin(passport[bits], passport[bits | (1 << i)]);
        }
    }
    for(int bits = 0; bits < (1 << K); bits++) {
        for(int j = bits + 1; ; ) {
            j--;
            if(j < 0) break;
            j = j & bits;
            chmin(passport[bits], passport[j] + passport[bits^j]);
        }
        //cerr << bits << " " << passport[bits] << endl;
    }
    int ans = 1e9;
    for(int bits = 0; bits < (1 << K); bits++) {
        chmin(ans, passport[bits] + f(bits));
    }
    if(ans == 1e9) ans = -1;
    cout << ans << endl;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M >> H >> K) {
        if(N == 0) break;
        solve();
    }
    return 0;
}


Measured memory_bytes: 3168