#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n,m,h,k;
  while(cin>>n>>m>>h>>k,n){
    struct edge{
      int to,cost,time;
      edge(int to,int cost,int time):
        to(to),cost(cost),time(time){}
    };
    vector< vector< vector< edge > > > G(k,vector< vector<edge> >(n));
    for(int i=0;i<m;i++){
      int a,b,c,h,r;
      cin>>a>>b>>c>>h>>r;
      a--;b--;r--;
      G[r][a].emplace_back(b,c,h);
      G[r][b].emplace_back(a,c,h);
    }

    int s,t;
    cin>>s>>t;
    s--;t--;

    int ps=1<<k;
    const int INF = 1e9;
    vector<int> dp(ps,INF);
    dp[0]=0;

    int p;
    cin>>p;
    for(int i=0;i<p;i++){
      int l,d;
      cin>>l>>d;
      int bit=0,v=0;
      for(int j=0;j<l;j++){
        cin>>v;
        v--;
        bit|=1<<v;
      }
      chmin(dp[bit],d);
    }

    for(int i=0;i<ps;i++)
      for(int j=0;j<ps;j++)
        chmin(dp[i|j],dp[i]+dp[j]);

    int ans=INF;
    for(int bit=0;bit<ps;bit++){
      using T = tuple<int, int, int>;
      priority_queue<T, vector<T>, greater<T> > pq;
      vector< vector<int> > dist(n,vector<int>(h+1,INF));
      dist[s][0]=0;
      pq.emplace(dist[s][0],s,0);

      while(!pq.empty()){
        int d,v,ch;
        tie(d,v,ch)=pq.top();pq.pop();
        if(dist[v][ch]<d) continue;
        for(int i=0;i<k;i++){
          for(auto e:G[i][v]){
            int u=e.to;
            int nd=d+(((bit>>i)&1)?0:e.cost);
            int nh=ch+e.time;
            if(nh>h) continue;
            if(dist[u][nh]<=nd) continue;
            dist[u][nh]=nd;
            pq.emplace(dist[u][nh],u,nh);
          }
        }
      }
      for(int res:dist[t]) chmin(ans,res+dp[bit]);
    }
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
  }
  return 0;
}

