#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned uint;
// typedef long long Int;

const int INF = 1001001001;
// const Int INFLL = 1001001001001001001LL;

struct Info {
	int to, cost, time, com;
	Info(int to, int cost, int time, int com) : to(to), cost(cost), time(time), com(com){}
	Info(){}
};

bool operator < (const Info &a, const Info &b)
{
	return (a.cost > b.cost);
}

int main()
{
	int n, m, h, k;
	
	while (scanf("%d %d %d %d", &n, &m, &h, &k) && n){
		vector<Info> G[128];
		
		for (int i = 1; i <= m; i++){
			int a, b, c, th, r;
			scanf("%d %d %d %d %d", &a, &b, &c, &th, &r);
			--r;
			G[a].push_back(Info(b, c, th, r));
			G[b].push_back(Info(a, c, th, r));
		}
		
		int s, t;
		
		scanf("%d %d", &s, &t);
		
		int p;
		scanf("%d", &p);
		
		int dp[256];
		
		fill(dp, dp + 256, INF);
		
		dp[0] = 0;
		for (int i = 0; i < p; i++){
			int l, d;
			int mask = 0;
			scanf("%d %d", &l, &d);
			for (int j = 0; j < l; j++){
				int x;
				scanf("%d", &x);
				--x;
				
				mask |= (1 << x);
			}
			
			for (int j = 0; j < 256; j++){
				dp[j | mask] = min(dp[j | mask], dp[j] + d);
			}
		}
		
		int ret = INF;
		
		for (int i = 0; i < (1 << k); i++){
			vector<Info> tmp[128];
			
			for (int j = 1; j <= n; j++){
				tmp[j] = G[j];
			}
			
			for (int j = 1; j <= n; j++){
				for (int k = 0; k < tmp[j].size(); k++){
					if ((i >> G[j][k].com) & 1) tmp[j][k].cost = 0;
				}
			}
			
			priority_queue<Info> pq;
			bool done[128][25] = {0};
			
			for (pq.push(Info(s, 0, 0, -1)); !pq.empty(); pq.pop()){
				Info x = pq.top();
				
				if (done[x.to][x.time]) continue;
				done[x.to][x.time] = true;
				
				if (x.to == t){
					ret = min(ret, x.cost + dp[i]);
				}
				
				for (int j = 0; j < tmp[x.to].size(); j++){
					Info e = tmp[x.to][j];
					if (x.time + e.time > h) continue;
					pq.push(Info(e.to, x.cost + e.cost, x.time + e.time, -1));
				}
			}
		}
		
		printf("%d\n", ret != INF ? ret : -1);
	}
}