#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 3;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

struct Edge
{
    int from, to, cost, hour, company;
};

using Graph = vector<vector<Edge>>;

struct State
{
    int pos, hour, cost;
};

bool operator<(const State &e, const State &f)
{
    return e.cost > f.cost;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M, H, K;
    while (cin >> N >> M >> H >> K, N || M || H || K)
    {
        Graph g(N);
        for (int i = 0; i < M; i++)
        {
            int a, b, c, h, r;
            cin >> a >> b >> c >> h >> r;
            a--;
            b--;
            r--;
            g[a].push_back(Edge{a, b, c, h, r});
            g[b].push_back(Edge{b, a, c, h, r});
        }
        int st, gt;
        cin >> st >> gt;
        st--;
        gt--;
        int P;
        cin >> P;
        vector<int> mask(P, 0), p(P, 0);
        vector<int> bitDP(1 << K, INF);
        bitDP[0] = 0;
        for (int i = 0; i < P; i++)
        {
            int l;
            cin >> l >> p[i];
            for (int j = 0; j < l; j++)
            {
                int k;
                cin >> k;
                k--;
                mask[i] |= (1 << k);
            }
            for (int j = 0; j < (1 << K); j++)
            {
                bitDP[j | mask[i]] = min(bitDP[j | mask[i]], bitDP[j] + p[i]);
            }
        }
        int res = INF;
        for (int b = 0; b < (1 << K); b++)
        {
            if (bitDP[b] == INF)
                continue;
            // dp[i][j] := i 番目の駅に 時間 j に着く最小コスト
            vector<vector<int>> dp(N, vector<int>(H + 1, INF));
            priority_queue<State> q;
            dp[st][0] = 0;
            q.push(State{st, 0, 0});
            while (!q.empty())
            {
                State s = q.top();
                q.pop();
                int pos = s.pos, hour = s.hour, cost = s.cost;
                if (dp[pos][hour] < cost)
                    continue;
                for (const auto &e : g[pos])
                {
                    int to = e.to, c = e.cost, h = e.hour, r = e.company;
                    if (b & (1 << r))
                        c = 0;
                    if (hour + h > H)
                        continue;
                    if (dp[to][hour + h] <= cost + c)
                        continue;
                    dp[to][hour + h] = cost + c;
                    q.push(State{to, hour + h, dp[to][hour + h]});
                }
            }
            for (int i = 0; i <= H; i++)
            {
                res = min(res, bitDP[b] + dp[gt][i]);
            }
        }
        cout << (res == INF ? -1 : res) << endl;
    }
}

