#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef vector<int> Array;
const int INF = 1e+8;

int main() {
  while(1){
    int n,m,H,k;
    cin>>n>>m>>H>>k;
    if(!n)break;
    vector<tuple<int,int,int,int,int>> v;
    REP(i,m){
      int a,b,c,h,r;
      cin>>a>>b>>c>>h>>r;
      --a; --b; --r;
      v.emplace_back(a,b,c,h,r);
    }
    int s,t,p;
    cin>>s>>t>>p;
    --s;--t;
    Array cost1(1<<k);
    REP(i,1<<k){
      bitset<8> bs(i);
      Array ary(n*(H+1),INF);
      ary[s*(H+1)] = 0;
      REP(l,H+1) {
        REP(j,m) {
          int a,b,c,h,r;
          tie(a,b,c,h,r) = v[j];
          if (l+h>H) continue;
          int ai=a*(H+1), bi=b*(H+1);
          if (bs[r]) {
            ary[ai+l+h] = min(ary[ai+l+h], ary[bi+l]);
            ary[bi+l+h] = min(ary[bi+l+h], ary[ai+l]);
          } else {
            ary[ai+l+h] = min(ary[ai+l+h], ary[bi+l]+c);
            ary[bi+l+h] = min(ary[bi+l+h], ary[ai+l]+c);
          }
        }
      }
      int minc = INF;
      REP(j,H+1) minc = min(minc, ary[t*(H+1)+j]);
      cost1[i] = minc;
    }
    Array cost2(1<<k,INF);
    cost2[0] = 0;
    REP(i,p){
      Array tmp = cost2;
      int l,d;
      cin>>l>>d;
      int bits = 0;
      REP(j,l) {
        int kj;
        cin>>kj;
        --kj;
        bits |= 1 << kj;
      }
      REP(j,1<<k)
        tmp[j|bits] = min(tmp[j|bits],cost2[j]+d);
      swap(tmp,cost2);
    }
    int minc = INF;
    REP(i,1<<k) minc = min(minc, cost1[i]+cost2[i]);
    if(minc < INF)
      cout<<minc<<endl;
    else
      cout<<-1<<endl;
  }
  return 0;
}