#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 501

int a[SIZE], b[SIZE], c[SIZE], h[SIZE], r[SIZE];
int d[SIZE], passprice[1<<8];

bool solve(){
  vector<pair<int,int> > way[SIZE];
  int n, m, p, H, K;
  int s,t;
  
  scanf("%d%d%d%d", &n, &m, &H, &K);

  if(H == 0) return false;
  
  for(int i=0;i<m;i++){
    scanf("%d%d%d%d%d", a+i, b+i, c+i, h+i, r+i);
    a[i]--; b[i]--; r[i]--;
    way[a[i]].push_back({i, b[i]});
    way[b[i]].push_back({i, a[i]});
  }

  scanf("%d%d%d", &s, &t, &p);
  s--; t--;

  for(int i=0;i<(1<<K);i++) passprice[i] = INF;
  passprice[0] = 0;
  
  for(int i=0;i<p;i++){
    int l, b, q = 0, d;
    scanf("%d%d", &l, &d);
    for(int j=0;j<l;j++){
      scanf("%d", &b);
      b--;
      q |= 1 << b;
    }

    for(int j=(1<<K)-1;j>=0;j--){
      passprice[j|q] = min(passprice[j|q], passprice[j] + d);
    }
  }

  int ans = INF;
  
  for(int freepass=0;freepass<(1<<K);freepass++){
    if(passprice[freepass] == INF) continue;
    
    priority_queue<pair<int,int> > pq;
    bool visited[SIZE*25] = {};
    pq.push({0, s});

    while(pq.size()){
      int now = pq.top().second;
      int cost = -pq.top().first;
      pq.pop();

      if(visited[now]) continue;
      visited[now] = true;

      if (now%n == t){
        ans = min(ans, cost + passprice[freepass]);
        break;
      }

      for(int i=0;i<way[now%n].size();i++){
        int id = way[now%n][i].first;
        int to = (now / n + h[id]) * n + way[now%n][i].second;
        if(to / n > H) continue;
        int newcost = cost;
        if(!(freepass & (1 << r[id]))) newcost += c[id];
        
        pq.push({-newcost, to});
      }
    }

  }

  if(ans == INF) ans = -1;
  
  printf("%d\n", ans);
  
  return true;
}

int main(){
  while(solve());
  
  return 0;
}

