#include <bits/stdc++.h>
using namespace std;

#define INF 0x3fffffff

typedef pair<int, int> Data;
typedef pair<int, Data> Pair;

struct Edge {
  int to;
  int len;
  int hour;
  int type;
};

int N;
int M;
int H;
int K;
int S;
int T;
int P;
int ds[1145];
int bs[1145];
int dp[1145];
bool used[1145];
int mind[114][30];
vector<Edge> es[114];

int Dijkstra(int st) {
  priority_queue<Pair, vector<Pair>, greater<Pair>> q;
  for (int i=0; i<N; i++) {
    for (int j=0; j<=24; j++) mind[i][j] = INF;
  }
  mind[S][0] = 0;
  q.push(Pair(0, Data(S, 0)));
  while (!q.empty()) {
    Pair p = q.top(); q.pop();
    Data d = p.second;
    int cost = p.first;
    int v = d.first;
    int h = d.second;
    if (mind[v][h] < cost) continue;
    for (Edge &e : es[v]) {
      int nh = h+e.hour;
      if (nh > 24) continue;
      int len = e.len;
      if (st >> e.type & 1) len = 0;
      int u = e.to;
      if (mind[u][nh] > mind[v][h]+len) {
        mind[u][nh] = mind[v][h]+len;
        q.push(Pair(mind[u][nh], Data(u, nh)));
      }
    }
  }

  int ret = INF;
  for (int i=0; i<=H; i++) {
    ret = min(ret, mind[T][i]);
  }
  return ret;
}

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

    for (int i=0; i<N; i++) es[i].clear();

    for (int i=0; i<M; i++) {
      int a, b, c, h, r;
      scanf("%d%d%d%d%d", &a, &b, &c, &h, &r);
      --a;
      --b;
      --r;
      es[a].emplace_back(Edge{b, c, h, r});
      es[b].emplace_back(Edge{a, c, h, r});
    }

    scanf("%d%d", &S, &T);
    --S;
    --T;
    scanf("%d", &P);
    for (int i=0; i<P; i++) {
      int l, k;
      scanf("%d%d", &l, &ds[i]);
      bs[i] = 0;
      for (int j=0; j<l; j++) {
        scanf("%d", &k);
        --k;
        bs[i] |= 1 << k;
      }
    }

    int lim = 1 << K;
    fill(dp, dp+lim, INF);
    fill(used, used+lim, false);
    dp[0] = 0;
    while (1) {
      int u = -1;
      for (int i=0; i<lim; i++) {
        if (used[i]) continue;
        if (u == -1 || dp[u] > dp[i]) u = i;
      }
      if (u == -1) break;
      used[u] = true;
      
      for (int i=0; i<P; i++) {
        int v = u | bs[i];
        if (dp[v] > dp[u]+ds[i]) {
          dp[v] = dp[u]+ds[i];
        }
      }
    }
    
    int ans = INF;
    for (int st=0; st<lim; st++) {
      ans = min(ans, Dijkstra(st)+dp[st]);
    }
    if (ans == INF) puts("-1");
    else printf("%d\n", ans);
  }
}