#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
 
using namespace std;
 
typedef pair<int,int> ii;
const int MAX_V = 101;
const int IINF = INT_MAX;
struct Edge { int dst,weight,hour,comp; };
struct Data {
  int cur,weight,hour,bitmask;
  bool operator < ( const Data &data ) const {
    if( weight != data.weight ) return weight > data.weight;
    if( hour   != data.hour   ) return hour   > data.hour;
    if( cur    != data.cur    ) return cur    > data.cur;
    return bitmask > data.bitmask;
  }
};
int V,E,H,K,S,T;
vector<Edge> G[MAX_V];
int mindist[MAX_V][1<<8][27];//,dp[1<<8];
//vector<vector<vector<int> > > mindist(MAX_V,vector<int>(1<<8,vector<int>(27)));
vector<int> dp(1<<8,0);
 
//iwefaojfwajoefopwaefjpawoejfawopejfjaweog:ghwouuuuuoooooofjewjafoeoiyaaaaafewafw
vector<ii> pass(333);
 
void set_up(){
  int P;
    cin >> P;
    assert( 0 <= P && P <= ((1<<K)-1));
 
    int l,d,k;
    rep(i,P){
 
      cin >> l >> d;
      assert( 1 <= l && l <= K );
      assert( 1 <= d && d <= 10000 );
      pass[i].first = d;
      pass[i].second = 0;
      rep(j,l) {
    cin >> k;
    assert( 1 <= k && k <= K );
    --k;
    pass[i].second |= (1<<k);
      }
    }
 
  rep(i,(1<<K)) dp[i] = IINF;
  dp[0] = 0;
  rep(i,(1<<K)) if( dp[i] != IINF ) {
    rep(j,P) {
      int bit = i | pass[j].second;
      dp[bit] = min(dp[bit],dp[i]+pass[j].first);
    }
  }
}
 
void compute(){
 
  set_up();
  priority_queue<Data> Q;
  rep(i,V) rep(j,(1<<K)) rep(k,H+1) mindist[i][j][k] = IINF;
  rep(i,(1<<K)) if( dp[i] != IINF ) {
    Q.push((Data){S,dp[i],0,i});
    mindist[S][i][0] = dp[i];
  }
  while( !Q.empty() ){
    Data data = Q.top(); Q.pop();
    //cout << data.cur << " " << data.weight  << " " << data.hour << " <= " << H << endl;
    if( data.cur == T ) { cout << data.weight << endl; return; }
    rep(i,G[data.cur].size()){
      int next = G[data.cur][i].dst;
      int nhour = data.hour + G[data.cur][i].hour;
      int cost = data.weight;
      if( !( ( data.bitmask >> G[data.cur][i].comp ) & 1 ) ) cost += G[data.cur][i].weight;
      if( nhour > H ) continue;
      if( mindist[next][data.bitmask][nhour] > cost) {
    mindist[next][data.bitmask][nhour] = cost;
    Q.push((Data){next,cost,nhour,data.bitmask});
      }
    }
  }
  puts("-1");
}
 
int main(){
  while( cin >> V >> E >> H >> K, V|E|H|K ) {
    assert( 2 <= V && V <= 100 );
    assert( 1 <= E && E <= 500 );
    assert( 1 <= H && H <= 24 );
    assert( 1 <= K && K <= 8 );
 
 
    rep(i,V) { G[i].clear(); }
 
    int a,b,c,h,r;
    rep(i,E) {
      cin >> a >> b >> c >> h >> r;
      assert( 1 <= a && a < b && b <= V );
      assert( 1 <= c && c <= 10000 );
      assert( 1 <= h && h <= H );
      assert( 1 <= r && r <= K );
      --a, --b, --r;
      G[a].push_back((Edge){b,c,h,r});
      G[b].push_back((Edge){a,c,h,r});
    }
     
    cin >> S >> T;
    assert( 1 <= S && S <= V );
    assert( 1 <= T && T <= V );
    --S, --T;
     
 
 
    compute();
     
  }
  return 0;
}