import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

struct Edge {
    int a, b, c, h, r;
}
 
int N, M, H, K;
Edge[][] G;
int S, T;
int P;
int[] Pass;

bool input() {
    scanf("%d %d %d %d\n", &N, &M, &H, &K);
    if (N == 0 && M == 0 && H == 0 && K == 0) return false;
    G = new Edge[][N];
    foreach (i; 0 .. M) {
        int a, b, c, h, r;
        scanf("%d %d %d %d %d\n", &a, &b, &c, &h, &r);
        a--; b--; r--;
        G[a] ~= Edge(a, b, c, h, r);
        G[b] ~= Edge(b, a, c, h, r);
    }
    scanf("%d %d\n", &S, &T);
    S--; T--;
    scanf("%d\n", &P);
    Pass = new int[256];
    Pass[] = int.max / 4;
    foreach (i; 0 .. P) {
        int l, d; scanf("%d %d\n", &l, &d);
        int bit = 0;
        foreach (j; 0 .. l) {
            int k;
            scanf("%d", &k);
            k--;
            bit |= (1 << k);
        }
        Pass[bit] = d;
    }
    return true;
}

void solve() {
    void initPass() {
        Pass[0] = 0;
        foreach (i; 0 .. 256) {
            foreach (j; 0 .. 256) {
                Pass[i | j] = min(Pass[i | j], Pass[i] + Pass[j]);
            }
        }
    }
    initPass;
    struct State {
        int a, h, c;
    }
    int Dijkstra(int bit) {
        int[][] D = new int[][](N, H + 1);
        foreach (i; 0 .. N) D[i][] = int.max / 4;
        BinaryHeap!(Array!State, "a.c > b.c") PQ;
        PQ.insert(State(S, 0, 0));
        D[S][0] = 0;
        while (!PQ.empty) {
            State cur = PQ.front; PQ.removeFront;
            foreach (edge; G[cur.a]) {
                int next_h = cur.h + edge.h;
                if (next_h > H) continue;
                int cost = ((bit & (1 << edge.r)) ? 0 : edge.c);
                if (D[edge.b][next_h] > D[cur.a][cur.h] + cost) {
                    D[edge.b][next_h] = D[cur.a][cur.h] + cost;
                    PQ.insert(State(edge.b, next_h, D[edge.b][next_h]));
                }
            }
        }
        return D[T].reduce!min;
    }

    int Ans = int.max / 4;
    foreach (bit; 0 .. 256) {
        Ans = min(Ans, Dijkstra(bit) + Pass[bit]);
    }
    writeln(Ans == int.max / 4 ? -1 : Ans);
}

void main() {
    while (input) solve;
}