#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
struct edge{
	int to,c,t,r;
	edge(int a,int b,int e,int d){to=a,c=b,t=e,r=d;}
};
int inf=1e9;
int N,M,H,K;
int b[256],d[256],dp[256];
int dis[25][100];
vector<edge> G[100];
void init(){
	rep(i,N) G[i].clear();
}
int main(){
	while(true){
		cin>>N>>M>>H>>K;
		if(N==0) break;
		init();
		rep(i,M){
			int a,b,c,h,r;
			cin>>a>>b>>c>>h>>r;
			a--,b--,r--;
			G[a].pb(edge(b,c,h,r));
			G[b].pb(edge(a,c,h,r));
		}
		int S,T;
		cin>>S>>T;
		S--,T--;
		int P;
		cin>>P;
		rep(i,P){
			int n;
			cin>>n>>d[i];
			int x=0;
			rep(j,n){
				int a;
				cin>>a;
				x|=(1<<(a-1));
			}
			b[i]=x;
		}
		rep(i,1<<K) dp[i]=inf;
		dp[0]=0;
		rep(i,1<<K){
			rep(j,P) chmin(dp[i|b[j]],dp[i]+d[j]);
		}
		int ans=inf;
		rep(bit,1<<K){
			rep(i,H+1) rep(j,N) dis[i][j]=inf;
			dis[0][S]=0;
			rep(i,H) rep(j,N){
				for(edge e:G[j]){
					if(i+e.t<=H) chmin(dis[i+e.t][e.to],dis[i][j]+( ( (bit>>e.r)&1 )?0:e.c  ) );
				}
			}
			int tmp=inf;
			rep(i,H+1) chmin(tmp,dis[i][T]);
			chmin(ans,tmp+dp[bit]);
		}
		if(ans>=inf) ans=-1;
		cout<<ans<<endl;
	}
}