// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

struct Edge {
  int src, dst, c, h, r;
  Edge(int src, int dst, int c, int h, int r) : src(src), dst(dst), c(c), h(h), r(r) {}
};

using Graph = vector<vector<Edge>>;

int N, M, H, K, s, t;

int dijkstra(const Graph &g, int mask) {
  using state = tuple<int, int, int>;
  priority_queue<state, vector<state>, greater<state>> q;
  auto dist = vectors(N, H + 1, INF);
  dist[s][0] = 0;
  q.emplace(0, s, 0);
  while (q.size()) {
    int d, v, h;
    tie(d, v, h) = q.top();
    q.pop();
    if (dist[v][h] < d) continue;
    for (auto &e : g[v]) {
      if (H < h + e.h) continue;
      int c = d + ((mask >> e.r) & 1 ? 0 : e.c);
      if (cmin(dist[e.dst][h + e.h], c)) q.emplace(c, e.dst, h + e.h);
    }
  }
  int mini = INF;
  for (auto &x : dist[t]) cmin(mini, x);
  return mini;
}

main {
  while (cin >> N >> M >> H >> K, N) {
    Graph g(N);
    rep(i, M) {
      int a, b, c, h, r;
      cin >> a >> b >> c >> h >> r;
      --a, --b, --r;
      g[a].emplace_back(a, b, c, h, r);
      g[b].emplace_back(b, a, c, h, r);
    }
    cin >> s >> t;
    --s, --t;
    int P;
    cin >> P;
    vector<int> dp(1 << K, INF);
    dp[0] = 0;
    rep(i, P) {
      int l, d, mask = 0;
      cin >> l >> d;
      while (l--) {
        int k;
        cin >> k;
        --k;
        mask |= 1 << k;
      }
      cmin(dp[mask], d);
    }
    rep(i, 1 << K) rep(j, 1 << K) cmin(dp[i | j], dp[i] + dp[j]);
    int ans = INF;
    rep(i, 1 << K) cmin(ans, dp[i] + dijkstra(g, i));
    cout << (ans == INF ? -1 : ans) << endl;
  }
}



Measured memory_bytes: 3320