#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll inf = 1e14;

ll N,M,H,K,s,t,p;
struct e{
    ll to,cost,dist,comp;
};

struct state{
    ll node,dist,cost;
    bool operator<(const state& right)const{
        return cost>right.cost;
    }
};

int main(){
    while(cin >> N >> M >> H >> K && N>0){
        vector<vector<ll>> dist(N,vector<ll>(N,inf));
        vector<ll> dp(1<<K,inf),cost(1<<K,inf);
        vector<vector<e>> v(N+1);
        ll a,b,c,h,r;
        for(int i=0;i<M;i++){
            cin >> a >> b >> c >> h >> r;
            a--; b--; r--;
            v[a].push_back({b,c,h,r});
            v[b].push_back({a,c,h,r});
        }
        cin >> s >> t >> p;
        s--; t--;
        ll l,d,k;
        for(int i=0;i<p;i++){
            cin >> l >> d;
            int S = 0;
            for(int j=0;j<l;j++){
                cin >> k; k--;
                S += (1<<k);
            }
            cost[S] = min(cost[S],d);
        }
        dp[0] = 0;
        for(int S=0;S<(1<<K);S++){
            for(int T=0;T<(1<<K);T++){
                dp[S|T] = min(dp[S|T],dp[S]+min(dp[T],cost[T]));
            }
        }
        ll ans = inf;
        for(int S=0;S<(1<<K);S++){
            if(dp[S]==inf) continue;
            vector<vector<ll>> dij(N,vector<ll>(H+1,inf));
            dij[s][0] = 0;
            priority_queue<state> Q;
            Q.push({s,0,0});
            while(!Q.empty()){
                state now = Q.top(); Q.pop();
                if(dij[now.node][now.dist]<now.cost) continue;
                for(auto x:v[now.node]){
                    if(now.dist+x.dist>H) continue;
                    state ne = now;
                    ne.node = x.to;
                    ne.dist += x.dist;
                    ne.cost += (S&(1<<x.comp)? 0:x.cost);
                    if(dij[ne.node][ne.dist]>ne.cost){
                        dij[ne.node][ne.dist] = ne.cost;
                        Q.push(ne);
                    }
                }
            }
            for(int i=0;i<=H;i++) ans = min(ans,dij[t][i]+dp[S]);
        }
        cout << (ans!=inf? ans:-1) << endl;
    }
}
