def compute_portfolio(passports, n)
	max = (1 << n) - 1	
	table = (0..1).map{ Array.new(max+1, Float::INFINITY) }
	table[0][0] = 0
	table[1][0] = 0
	for i in 0..passports.size-1
		c, bits = passports[i]
		for j in 0..max
			table[1][j] = table[0][j] if table[0][j] < table[1][j] 
			x = table[0][j] + c
			table[1][j | bits] = x if x < table[1][j | bits]
		end
		table << table.shift
	end
	table[0]
end

loop.with_index {|_, itr|
	n, m, available_time, k = gets.split.map &:to_i
	break if n == 0
	
	len = (0..n).map{|i| {} }
	time = (0..n).map{|i| {} }
	company = (0..n).map{|i| {} }

	m.times{
		a, b, l, t, c = gets.split.map &:to_i
		len[a][b] = len[b][a] = l
		time[a][b] = time[b][a] = t
		company[a][b] = company[b][a] = c-1
	}
	
	start, goal = gets.split.map &:to_i

	p_num = gets.to_i
	passports = []
	p_num.times {
		_, price, *companies = gets.split.map &:to_i
		bits = 0
		companies.each{|i| bits |= (1 << i-1)}
		passports << [price, bits]
	}

	portfolio = compute_portfolio(passports, k)

	min_cost = Float::INFINITY
	(0..(1<<k)-1).to_a.sort_by{|x| portfolio[x]}.each{|x|
		passport_cost = portfolio[x]
		break if passport_cost >= min_cost

		dist = (0..available_time).map{ (0..n).map{ Float::INFINITY } }
		dist[available_time][start] = 0

		available_time.downto(1).each{|h|
			(1..n).each{|i|
				d0 = dist[h][i]
				next if d0 >= min_cost
				len[i].each{|j, l|
					t = time[i][j]
					next if h < t
					c = company[i][j]
					d = (x[c] == 1 ? d0 : d0 + l)
					dist[h-t][j] = d if d < dist[h-t][j]
				}
			}
		}

		road_cost = (0..available_time).map{|h| dist[h][goal]}.min
		total_cost = passport_cost + road_cost
		min_cost = total_cost if total_cost < min_cost
	}

	p min_cost == Float::INFINITY ? -1 : min_cost
}