#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef int ll;
typedef long double ld;
using namespace std;

struct Dijkstra{
  ll INF=1000000000;
  ll MAX_V=1000000;
  ll st = -1;
  struct edge{ll to, cost;};
  typedef pair<ll, ll> p;
  vector<vector<edge>> G;
  vector<ll> pre, d;
  priority_queue<p, vector<p>, greater<p> > que; //class, inner, compair
  Dijkstra(ll s){
    G.resize(s+2);
    pre.resize(s+2, -1);
    d.resize(s+2, INF);
  }
  inline void insert(ll a, ll b, ll c){
    G[a].push_back(edge{b, c});
  }
  void init(){
    for(int i=0;i<d.size();i++) pre[i] = -1, d[i] = INF;
  }
  void dijkstra(int start){
    init();
    st = start;
    d[start]=0;
    que.push(p(0, start));
    while(!que.empty()){
      p p_now=que.top(); que.pop();
      ll v = p_now.second;
      if(d[v]<p_now.first) continue;
      for(int i=0;i<G[v].size();i++){
        edge e = G[v][i];
        if(d[e.to]>d[v]+e.cost){
          d[e.to]=d[v]+e.cost;
          pre[e.to] = v;
          que.push(p(d[e.to], e.to));
        }
      }
    }
  }
  vll get_path(int now){
    vll ret;
    while(now!=-1){
      ret.push_back(now);
      now = pre[now];
    }
    return ret;
  }
};
ll INF = 1000000000;
bool solve(){
  ll n, m, h, k, s, t, p;std::cin >> n >> m >> h >> k;
  if(n==0) return false;

  vector<vector<ll>> v = VV(m, 5, 0, ll);
  //train
  for(int i=0;i<m;i++){
    ll a, b, c, d, e;
    scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
    a--, b--, e--;
    v[i][0] = a, v[i][1] = b, v[i][2] = c, v[i][3] = d, v[i][4] = e;
  }
  // p < 256
  //2進数でエンコード
  //(価格,会社)
  scanf("%d %d", &s, &t);
  s--, t--;
  scanf("%d", &p);
  vvl pas = VV(p, 2, 0, ll);
  for(int i=0;i<p;i++){
    ll BIT = 0;
    ll x, y;scanf("%d %d", &x, &y);
    for(int j=0;j<x;j++){
      ll ok;scanf("%d", &ok);
      BIT += (1<<(ok-1));
    }
    pas[i][0] = y; //価格
    pas[i][1] = BIT; //行ける
  }
  vvl dp = VV(p+1, (1<<k), INF, ll);
  dp[0][0] = 0;
  dp[p][0] = 0;
  for(int i=0;i<p;i++){
    //std::cout << pas[i][0] << " " << pas[i][1] << '\n';
    for(int j=0;j<(1<<k);j++){
      dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
      if(dp[i][j]==INF) continue;
      dp[i+1][j|pas[i][1]] = min(dp[i+1][j|pas[i][1]], dp[i][j] + pas[i][0]);
    }
  }
  // dp[i][j] := i枚目時点でjを網羅できる最低価格
  // dp[n][j] = bit jをタダで移動できるときのパスポート代金
  //パスポートによってjタダで移動できるとき
  // (256pat) * (500辺) log(500) H<24以下より早い

  ll ans = INF;
  for(int ok=0;ok<(1<<k);ok++){
    //if(ok==7) std::cout << dp[p][ok] << '\n';
    if(dp[p][ok]==INF) continue;
    ll cost = dp[p][ok];
    Dijkstra dj((h+1)*n);
    for(int i=0;i<m;i++){
      ll from = v[i][0], to = v[i][1];
      ll tm = v[i][3], price = v[i][2];
      if((ok>>v[i][4])&1) price = 0;
      for(int x=0;x<=h-tm;x++){
        dj.insert(x*n+from, (x+tm)*n+to, price);
        dj.insert(x*n+to, (x+tm)*n+from, price);
      }
    }
    dj.dijkstra(0 + s);
    for(int i=0;i<=h;i++) ans = min(ans, dj.d[i*n+t] + cost);
  }
  if(ans==INF) std::cout << -1 << '\n';
  else std::cout << ans << '\n';
  return true;
}
int main(int argc, char const *argv[]) {
  while(true) if(!solve()) break;
  return 0;
}



Measured memory_bytes: 3792