def warshall_floyd(dist_matrix)
	dist = dist_matrix
	n = dist.size
	raise "dist_matrix is not square" if dist.any?{|row| row.size != n}

	next_dist = (1..n).map{ Array.new(n) }	
	(0..n-1).each{|k|
		dist_k = dist[k]
		(0..n-1).each{|i|
			dist_i = dist[i]
			next_dist_i = next_dist[i]
			(0..n-1).each{|j|
				x = dist_i[j]
				y = dist_i[k] + dist_k[j]
				next_dist_i[j] = (x < y ? x : y)
			}
		}
		dist = next_dist
	}
	dist
end

loop do
	n, m, l, s, t = gets.split.map(&:to_i)
	break if n == 0

	adj_mat = (0..n).map { (0..n).map { Float::INFINITY } }
	m.times do
		a, b, c = gets.split.map(&:to_i)
		adj_mat[a][b] = adj_mat[b][a] = c
	end
	dist = warshall_floyd(adj_mat)

	siros = [[s, 0]] + (1..l).map { gets.split.map(&:to_i) }
	siros.each do |j, e|
		dist.each {|to_dist| to_dist[j] += e}
	end
	dist = siros.map {|j, e| dist[j]}
	dist.map! {|to_dist| siros.map {|j, e| to_dist[j]}}

	max_num = 0
	hash = { 0 => {0 => 0} }
	(1..2**l-1).each do |visited|
		(1..l).each do |last_idx|
			next if visited[last_idx-1] == 0
			min = Float::INFINITY
			hash[visited - (1 << last_idx-1)].each do |k, d|
				new_d = d + dist[k][last_idx]
				min = new_d if new_d < min
			end
			(hash[visited] ||= {})[last_idx] = min
			if min + dist[last_idx][0] <= t
				c = visited.to_s(2).count(?1)
				max_num = c if c > max_num
			end
		end
	end

	p max_num
end