 #include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N,M,H,K;
LL a[1001];
LL b[1001];
LL c[10001];
LL h[10001];
LL r[10001];
int S,T;
int PPP;
LL l[1<<8];
LL d[1<<8];
LL k[1<<8];

LL dp[501][31];
bool used2[10];
LL now[1<<8];

typedef pair<int,int>P;
typedef pair<LL,P>PP;
struct edge{LL to, cost, h,r;};
vector<edge> G[1001];
//int d[1001];

void dijkstra(int s){
   //greater<PP>????????????????????¨??§first????°???????????????????????????????????????????
   priority_queue<PP, vector<PP>, greater<PP> > que;
   REP(i,501){
       REP(j,31){
           dp[i][j]=1e16;
       }
   }
   dp[s][0]=0;
   que.push(PP(0,P(s,0)));
   while(!que.empty()){
      PP p=que.top();que.pop();
      int v=p.second.first;
      int nh=p.second.second;
      if(dp[v][nh]< p.first)continue;
      REP(i,G[v].size()){
          edge e =G[v][i];
          int c_cost=e.cost;
          if(used2[e.r])c_cost=0;
          if(nh+e.h<=H){
             if(dp[e.to][nh+e.h] > dp[v][nh]+ c_cost){
                dp[e.to][nh+e.h] = dp[v][nh] + c_cost;
                que.push(PP(dp[e.to][nh+e.h],P(e.to,nh+e.h)));
             }
          }
      }
   }
}

LL dp2[1<<8];

int main(){
    while(cin>>N>>M>>H>>K,N){
       REP(i,1000){
           G[i].clear();
       }
       REP(i,M){
           cin>>a[i]>>b[i]>>c[i]>>h[i]>>r[i];
           a[i]--;b[i]--;r[i]--;
           G[a[i]].push_back(edge{b[i],c[i],h[i],r[i]});
           G[b[i]].push_back(edge{a[i],c[i],h[i],r[i]});
       }
       cin>>S>>T;
       S--;T--;
       cin>>PPP;
       REP(i,PPP){
           cin>>l[i]>>d[i];
           k[i]=0;
           REP(j,l[i]){
              int aa=0;
              cin>>aa;
              aa--;
              k[i]=(k[i]+(1<<aa));
           }
       }
       LL ans=1e18;
       REP(i,1<<K){
           now[i]=1e16;
           REP(j,K){
               used2[j]=false;
           }
           REP(j,K){
               if((i>>j)&1)used2[j]=true;
           }
           dijkstra(S);
           REP(o,H+1){
               now[i]=min(now[i],dp[T][o]);
           }
           //cout<<i<<" now "<<now[i]<<endl;
       }
       REP(i,1<<K){
           dp2[i]=1e16;
       }
       dp2[0]=0;
       REP(i,PPP){
           REP(j,1<<K){
               dp2[j|k[i]]=min(dp2[j|k[i]],dp2[j]+d[i]);
           }
       }
       
       REP(i,1<<K){
           ans=min(ans,dp2[i]+now[i]);
       }
       if(ans==1e16){
          cout<<-1<<endl;
       }else{
          cout<<ans<<endl;
       }
    }
    return 0;
}