#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

typedef int Weight;
struct Edge
{
	int to; Weight cost;
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ to, cost });
}
void dijkstra(Graph &g, Array &d, int s)
{
	d.assign(g.size(), INF);
	d[s] = 0;
	typedef pair<Weight, int> P;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		Weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size())
		{
			Edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

struct D { int a, b, c, h, r; };
int main()
{
	int n, m, h, k;
	while (cin >> n >> m >> h >> k, n)
	{
		vector<D> v;
		REP(i, m)
		{
			int a, b, c, h, r;
			cin >> a >> b >> c >> h >> r;
			a--; b--; r--;
			v.push_back({ a,b,c,h,r });
		}
		int s, t;
		cin >> s >> t;
		s--; t--;
		vi cost(1 << k, INF);
		REP(ii, 1 << k)
		{
			Graph g(n*(h + 1));
			REP(i, m)
			{
				bool f = (ii >> v[i].r) & 1;
				REP(j, h - v[i].h + 1)
				{
					add_edge(g, v[i].a + n*j, v[i].b + n*(j + v[i].h), f ? 0 : v[i].c);
					add_edge(g, v[i].b + n*j, v[i].a + n*(j + v[i].h), f ? 0 : v[i].c);
				}
			}
			Array d;
			dijkstra(g, d, s);
			REP(i, h + 1) chmin(cost[ii], d[t + i*n]);
		}
		int p; cin >> p;
		vector<pii> pass;
		REP(i, p)
		{
			int l, d; cin >> l >> d;
			int bit = 0;
			REP(j, l)
			{
				int a; cin >> a; a--;
				bit |= (1 << a);
			}
			pass.emplace_back(bit, d);
		}
		Graph g(1 << k);
		Matrix mat(333, Array(333, INF));
		REP(i, 1 << k)
		{
			REP(j, p)
			{
				int to = i | pass[j].first;
				chmin(mat[i][to], pass[j].second);
			}
		}
		
		REP(i, 1 << k)REP(j, 1 << k)
		{
			if (mat[i][j] < INF) add_edge(g, i, j, mat[i][j]);
		}
		
		Array price;
		dijkstra(g, price, 0);
		int ans = INF;
		REP(i, 1 << k)
		{
			chmin(ans, cost[i] + price[i]);
		}
		if (ans >= INF) puts("-1");
		else cout << ans << endl;
	}
	return 0;
}