#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
const int INF = 1001001001;
const int MOD = 1000000007;


// verified : http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A
// 負辺があると動作しない?
// O(E log V)
template<typename T>
vector<T> dijkstra(vector<vector<pair<int, T>>> &g, int s){
     
    int n = g.size();
    // numeric_limits がうまく使えない場合は自分で INF を定義する.
    const auto inf = numeric_limits<T>::max();
    vector<T> dist(n, inf);
 
    using P = pair<T, int>;
    // 小さい順に取り出せる
    priority_queue<P, vector<P>, greater<P>> que;
    dist[s] = 0;
    que.emplace(dist[s], s);
    while(!que.empty()){
        T cost;
        int node;
        tie(cost, node) = que.top();
        que.pop();
        if(dist[node] < cost) continue;
        for(auto &e : g[node]){
            auto next_cost = cost + e.second;
            int next_node = e.first;
            if(dist[next_node] <= next_cost) continue;
            dist[next_node] = next_cost;
            que.emplace(next_cost, next_node);
        }
    }
 
    return dist;
}

int solve(){
    
    int n, m, H, k; cin >> n >> m >> H >> k;
    if(n == 0) return 0;

    vector<int> a(m); 
    vector<int> b(m); 
    vector<int> c(m); 
    vector<int> h(m); 
    vector<int> r(m);
    
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i] >> c[i] >> h[i] >> r[i];
        a[i]--;
        b[i]--;
        r[i]--;
    }

    int s, t; cin >> s >> t;
    s--;
    t--;

    int p; cin >> p;
    vector<vector<int>> dp(p + 1, vector<int> ((1 << k), INF));
    dp[0][0] = 0;

    for(int i = 0; i < p; i++){
        int l, r; cin >> l >> r;
        vector<int> camps(l);
        for(int j = 0; j < l; j++){
            cin >> camps[j];
            camps[j]--;
        }

        for(int bit = 0; bit < (1 << k); bit++){
            if(dp[i][bit] == INF) continue;

            // not-take
            dp[i + 1][bit] = min(dp[i + 1][bit], dp[i][bit]);

            // take
            int nxtbit = bit;
            for(int j = 0; j < l; j++){
                nxtbit = nxtbit | (1 << camps[j]);
            }

            dp[i + 1][nxtbit] = min(dp[i + 1][nxtbit], dp[i][bit] + r);
        }
    }
    /*
    for(int bit = 0; bit < (1LL << k); bit++){
        cerr << bitset<4>(bit) << " " << dp[p][bit] << endl;
    }
    */
    
    vector<vector<int>> toNode(n, vector<int> (H + 1));
    int cnt = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= H; j++){
            toNode[i][j] = cnt;
            cnt++;
        }
    }
    
    int ans = INF;
    int S = toNode[s][0];

    for(int bit = 0; bit < (1 << k); bit++){
        int tmp = dp[p][bit];

        // グラフ構築
        vector<vector<pair<int, int>>> gg(cnt);
        for(int i = 0; i < m; i++){
            for(int j = 0; j <= H; j++){
                if(j + h[i] > H) continue;
                int cur = toNode[a[i]][j];
                int nxt = toNode[b[i]][j + h[i]];
                int cost = c[i];
                if(bit & (1 << r[i])) cost = 0;

                gg[cur].push_back({nxt, cost});
                cur = toNode[b[i]][j];
                nxt = toNode[a[i]][j + h[i]];
                gg[cur].push_back({nxt, cost});

                
            }

            /*
            for(int j = 0; j <= H; j++){
                if(j + h[i] > H) continue;
                int cur = toNode[b[i]][j];
                int nxt = toNode[a[i]][j + h[i]];
                int cost = c[i];
                if(bit & (1LL << r[i])) cost = 0;

                gg[cur].push_back({nxt, cost});
            }
            */
        }

        // ダイクストラ
        int dist = INF;
        auto result = dijkstra(gg, S);
        for(int i = 0; i <= H; i++){
            int G = toNode[t][i];
            dist = min(dist, result[G]);
        }

        tmp += dist;
        ans = min(ans, tmp);
    }
    
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;


    return 1;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(solve()){}
    return 0;
}



Measured memory_bytes: 3772