#include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;

#define INF 1e9

int min(int a, int b){ return a < b ? a : b; }

int main(void){
  while(true){
    int N, M, H, K;
    cin >> N >> M >> H >> K;
    if(N == 0 && M == 0 && H == 0 && K == 0){ break; }

    // ?????\: ????????????????????¨???????????????????????§?±???????(?????§256???)
    // ?????????????????°??????1????????¨?????????????????°??????????????¨?????\??????????????¨???????????????(1??°?????????????????§24??????)
    // ???????¨??????? O(P * H * ElogE) = O(256 * 24 * 500 * 8)
    // ??? 10^7????????????  or  *=H??§10^8????????????????????????
    
    // ??£??\?????????????§????
    int a, b, c, h, r;
    vector<vector<pair<pair<int, pair<int, int> >, int> > > adjlist(N); // ((??????, (to, ????????????)), ????????????)
    for(int i = 0; i < M; i++){
      cin >> a >> b >> c >> h >> r;
      --a; --b; --r;
      adjlist[a].push_back(make_pair(make_pair(c, make_pair(b, h)), r));
      adjlist[b].push_back(make_pair(make_pair(c, make_pair(a, h)), r));
    }


    // ?§??????¨??????????????±
    int S, T;
    cin >> S >> T;
    --S; --T;
    
    // ???????????????????????±???????????????
    vector<int> passport(1 << K, INF);
    passport[0] = 0;
    int P, l, k, d;
    cin >> P;
    for(int i = 1; i < P + 1; i++){
      int flag = 0;
      cin >> l >> d;
      for(int j = 0; j < l; j++){
        cin >> k;
        flag |= 1 << (k - 1);
      }

      // ???????????????????????????????????????????????´??°??????
      if(passport[flag] > d){
        passport[flag] = d;
        // ???????????????????????????????????§?¶??????????????????????????´?????????????????????????????????´??°??????
        for(int j = 0; j < K; j++){
          if((flag & (1 << j)) != 0){
            passport[1 << j] = min(passport[1 << j], passport[flag]);
          }
        }
      }
    }

    // ?????????????????????????????????????????????
    for(int i = 0; i < (1 << K); i++){
      for(int j = 0; j < (1 << K); j++){
        passport[i ^ j] = min(passport[i ^ j], passport[i] + passport[j]);
      } 
    }
    
    // ???????????????????????????????????????????????????????????????????????????
    int mincost = INF;
    for(int p = 0; p < passport.size(); p++){
      if(passport[p] == INF){ continue; }
      
      priority_queue<pair<int, pair<int, int> > > wait;
      vector<vector<int> > result(N, vector<int>(H + 1, INF));
      // ??????????????°???????????±???????????????????????£??§?¨????
      for(int i = 0; i <= H; i++){ result[S][i] = passport[p]; }
      wait.push(make_pair(-passport[p], make_pair(0, S)));
      
      // ?????????????????????
      while(!wait.empty()){
        int nowpoint = (wait.top()).second.second;
        int nowtime = (wait.top()).second.first;
        int nowcost = -(wait.top()).first;
        wait.pop();
        if(result[nowpoint][nowtime] < nowcost){ continue; }

        for(int i = 0; i < adjlist[nowpoint].size(); i++){
          int nextpoint = adjlist[nowpoint][i].first.second.first;
          // ????????????????????????????????????????????????????????§????????°?????????????????????????????????
          int nextrail = adjlist[nowpoint][i].second;
          int nextcost = nowcost + ((p & (1 << nextrail)) == 0 ? adjlist[nowpoint][i].first.first : 0);
          int nexttime_start = nowtime + adjlist[nowpoint][i].first.second.second;
          for(int nexttime = nexttime_start; nexttime <= H; nexttime++){
            if(result[nextpoint][nexttime] > nextcost){
              result[nextpoint][nexttime] = nextcost;
              if(nexttime == nexttime_start){ wait.push(make_pair(-nextcost, make_pair(nexttime, nextpoint))); }
            }
          }
        }
      }
      
      // ????°?????????´??°??????
      if(mincost > result[T][H]){ mincost = result[T][H]; }
    }        
    
    // ???????????????
    if(mincost == INF){ cout << -1 << endl; }
    else{ cout << mincost << endl; }
  }
  
  return 0;
}

Measured memory_bytes: 1328