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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define rep(i, N) for (int i = 0; i < (N); i++)
#define rep2(i, j, N, M) rep(i, N) rep(j, M)
#define rep3(i, j, k, N, M, L) rep(i, N) rep(j, M) rep(k, L)
#define REP(i, init, N) for (int i = (init); i < (N); i++)

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int V, E, H, K;
int S, T;
int P;

struct Edge {
    int to, price, time, company;
};

vector<vector<Edge>> es;

struct Passport {
    int n; // company num
    int price;
    int companies;
};

vector<Passport> passports;

struct State {
    int v, time, price;
    bool operator > (const State &s) const { return price > s.price; }
};

int dijkstra(int price0, int free_company) {
    // prices[v][time] = min_prices;
    VVI prices(V, VI(H + 1, INF));

    priority_queue<State, vector<State>, greater<State>> q;
    {
        State s;
        s.v = S;
        s.time = 0;
        s.price = price0;
        q.push(s);
        prices[s.v][s.time] = s.price;
    }

    while (q.size()) {
        State cur = q.top();
        q.pop();

        if (prices[cur.v][cur.time] < cur.price) continue;

        // next
        for (auto &e : es[cur.v]) {
            State n;
            n.v = e.to;
            n.time = cur.time + e.time;

            if (n.time > H) continue;
            
            n.price = cur.price + (1 << e.company & free_company ? 0 : e.price);

            if (prices[n.v][n.time] > n.price) {
                prices[n.v][n.time] = n.price;
                q.push(n);
            }
        }
    }

    return *min_element(ALL(prices[T]));
}

int solve() {
    // create passport sum
    VI psums(1 << K, INF);
    psums[0] = 0;
    rep(i, 1 << K) {
        if (psums[i] == INF) continue;

        for (auto &p : passports) {
            int price = psums[i] + p.price;
            int companies = i | p.companies;
            if (psums[companies] > price) {
                psums[companies] = price;
            }
        }
    }

    // dijkstra
    int ans = INF;
    rep(i, 1 << K) {
        if (psums[i] == INF) continue;

        int res = dijkstra(psums[i], i);
        ans = min(ans, res);
    }

    return ans == INF ? -1 : ans;
}

int main(void) {
    while (cin >> V >> E >> H >> K, V) {
        es.clear();
        es.resize(V);
        rep(i, E) {
            int a, b, c, h, r;
            cin >> a >> b >> c >> h >> r;
            --a; --b; --r;
            Edge e1, e2;
            e1.to = b;
            e2.to = a;
            e1.price = e2.price = c;
            e1.time = e2.time = h;
            e1.company = e2.company = r;
            es[a].PB(e1);
            es[b].PB(e2);
        }

        cin >> S >> T >> P;
        --S; --T;

        passports.clear();
        rep(i, P) {
            Passport p;
            p.companies = 0;
            cin >> p.n >> p.price;
            rep(j, p.n) {
                int c;
                cin >> c;
                --c;
                p.companies |= 1 << c;
            }
            passports.PB(p);
        }

        cout << solve() << endl;
    }

	return 0;
}

Measured memory_bytes: 1340