#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> state;

const int MAX_N = 100;
const int MAX_H = 24;
const int MAX_K = 8;

struct edge{
  int to,cost,hour,col;
  edge(int a=0,int b=0, int c=0, int d=0):
    to(a),cost(b),hour(c),col(d){}
};

int N,M,K,C,S,T,H;
vector<edge> g[MAX_N+1];
int a,b,c,m,h;
int s,d,k;
int comb[1<<MAX_K];
int dis[MAX_H+1][MAX_N+1];

int main(){
  while(scanf("%d%d%d%d",&N,&M,&H,&K)>=0){
    if(N==0 && M==0 && H==0 && K==0)break;

    rep(i,N)g[i+1].clear();

    rep(i,M){
      scanf("%d%d%d%d%d",&a,&b,&c,&h,&m);
      g[a].pb(edge(b,c,h,m-1));
      g[b].pb(edge(a,c,h,m-1));
    }
    scanf("%d%d",&S,&T);

    scanf("%d",&C);

    memset(comb,-1,sizeof(comb));
    comb[0] = 0;
    rep(i,C){
      scanf("%d%d",&s,&d);
      int bit = 0;
      rep(i,s){
	scanf("%d",&k); k--;
	bit |= 1<<k;
      }
      comb[bit] = (comb[bit]<0?d:min(comb[bit],d));
    }

    rep(i,1<<K){
      if(comb[i]<0)continue;
      rep(j,1<<K){
	if(comb[j]<0)continue;

	int nxt = i|j;
	if(comb[nxt]<0 || comb[nxt] > comb[i] + comb[j]){
	  comb[nxt] = comb[i] + comb[j];
	}
      }
    }

    int ans = -1;
    rep(bit,1<<K){
      if(comb[bit]<0)continue;
      if(ans>=0 && ans<=comb[bit])continue;

      priority_queue<state> q;
      q.push(state(0,pii(0,S)));
      memset(dis,-1,sizeof(dis));
      dis[0][S] = 0;
      
      while(q.size()){
	state p = q.top(); q.pop();
	int cost = -p.first;
	int t = p.second.first, v = p.second.second;
	
	if(dis[t][v]<cost)continue;
	if(v==T)break;

	rep(i,g[v].size()){
	  int nxtv = g[v][i].to, nxtt = t+g[v][i].hour;
	  if(nxtt>H)continue;

	  int nxtcost = cost;
	  if( !((bit >> g[v][i].col) & 1) )nxtcost += g[v][i].cost;
	  
	  if(dis[nxtt][nxtv]<0 || dis[nxtt][nxtv] > nxtcost){
	    dis[nxtt][nxtv] = nxtcost;
	    q.push(state(-nxtcost, pii(nxtt,nxtv)));
	  }
	}
      }

      int val = -1;
      rep(i,H+1){
	if(val<0 || (dis[i][T]>=0 && val>dis[i][T]))val = dis[i][T];
      }
      if(val<0)continue;
      val += comb[bit];
      if(ans<0 || ans>val)ans = val;
    }
    
    cout << ans << endl;
  }
}