#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MP make_pair
using namespace std;
#define int long long
signed main(){
    int n,m,H,k,s,t,p;
    while(cin >> n >> m >> H >> k&&n!=0){
        vector<vector<pair<pair<int,int>,pair<int,int>> > > g(n);
        rep(i,m){
            int a,b,c,h,r;
            cin >> a >> b >> c >> h >> r;
            a--;b--;
            r--;
            g[a].push_back(MP(MP(b,h),MP(c,r)));
            g[b].push_back(MP(MP(a,h),MP(c,r)));
        }
        cin >> s >> t;
        s--;t--;
        cin >> p;
        int cost[1<<8];
        rep(i,(1<<8)){
            cost[i] = (1LL<<40);
        }
        cost[0] = 0;
        rep(i,p){
            int mm,ccc;
            cin >> mm >> ccc;
            int bits  = 0;
            rep(j,mm){
                int tt;
                cin >> tt;
                tt--;
                bits |= (1<<tt);
            }
            rep(sub,(1<<8)){
                if((sub&bits)==sub){
                    cost[sub] = min(cost[sub],ccc);
                }
            }
        }
        for(int bits=1;bits<(1<<8);bits++){
            for(int cc=1;cc<bits;cc++){
                cost[bits] = min(cost[bits],cost[cc]+cost[cc^bits]);
            }
        }
        int dp[25][101][1<<8];
        rep(i,25)rep(j,101)rep(kk,(1<<8))dp[i][j][kk] = (1LL<<40);
        
        priority_queue<pair<pair<int,int>,int >,vector<pair<pair<int,int>,int> >, greater<pair<pair<int,int>,int> > >  pq;
        rep(bits,1<<8){
            dp[0][s][bits] = cost[bits];
            pq.push(MP(MP(0,cost[bits]),s));
            while(!pq.empty()){
                auto x = pq.top();
                pq.pop();
                int id = x.second;
                int ti = x.first.first;
                int price = x.first.second;
                // if(bits==0)cerr << id << " " << ti << " " << price << " " << dp[ti][id][bits] << endl;
                if(dp[ti][id][bits]<price)continue;
                for(auto y:g[id]){
                    int nxt = y.first.first;
                    int dist = y.first.second;
                    int ccc = y.second.first;
                    int kind = y.second.second;
                    // if(bits==0)cerr << id << " " << nxt << " " << dist << " " << ccc << " " << kind << endl;
                    if(bits&(1<<kind))ccc = 0;
                    if(ti+dist <= H){
                        if(dp[ti+dist][nxt][bits]>price+ccc){
                            dp[ti+dist][nxt][bits] = price+ccc;
                            pq.push(MP(MP(ti+dist,price+ccc),nxt));
                        }
                    }
                }
            }
        }
        int mi = (1LL<<40);
        rep(bits,1<<8){
            for(int i=0;i<=H;i++){
                if(mi > dp[i][t][bits]){
                    mi = dp[i][t][bits]; 
                }
            }
        }
        if(mi!=(1LL<<40)){
            cout << mi << "\n";
        }else{
            cout << -1 << "\n";
        }
    }
    return 0;
}
