#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
int monster[3005];
vector<int>person[205];
int na = 100000;
int ans = na;
int n, m, p,k;
int head[205];
int to[3005];
int nt[3005];
int t[3005];
int cnt = 0;
int vis[205];
int persword[205];
int dp[205][1<<16];
bool visited[3005];
int dfs(int pos,int sword) {
int result =100000000;
int ssword = sword;
if (dp[pos][sword] != -1) { return dp[pos][sword];}
if (pos == n) { return 0;}
for (int i = 0; i < person[pos].size(); i++) {
sword |= persword[person[pos][i]];
}
int temp;
for (int ei = head[pos]; ei; ei = nt[ei]) {
if (visited[ei]) { continue; }
temp = sword;
temp |= monster[ei];
if (temp != sword) { continue; }
visited[ei] = true;
result=min(result,dfs(to[ei],sword)+t[ei]);
visited[ei] = false;
}
dp[pos][ssword] = result;
return result;
}
int main()
{
cin >> n >> m >> p >> k;
int w, q, r;
for (int i = 1;i <= 200; i++) {
for (int j =0; j <= 1 << 15; j++) {
dp[i][j] = -1;
}
}
for (int i = 1; i <= k; i++) {
cin >> w >> q;
person[w].push_back(i);
for (int j = 1; j <= q; j++) {
cin >> r;
if (r >= 14) { continue; }
persword[i] |= 1 << r;
}
}
int a,b,tt, s, u;
for (int i = 1; i <= m; i++) {
cin >> a >> b >> tt >> s;
nt[++cnt] = head[a];
to[cnt] = b;
t[cnt] = tt;
head[a] = cnt;
for (int j = 1; j <= s; j++) {
cin >> u;
monster[cnt] |= 1 << u;
}
nt[++cnt] = head[b];
to[cnt] = a;
t[cnt] = tt;
head[b] = cnt;
monster[cnt] = monster[cnt - 1];
}
int ans=dfs(1,0);
if (ans == na) { cout << -1 << endl; }
else { cout << ans << endl; }
}