#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	while (cin >> N >> M >> K >> L >> T, N) {
		vector<vector<int>>edge(N, vector<int>(N, MOD));
		for (int i = 0; i < M; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			a--, b--;
			edge[a][b] = c;
			edge[b][a] = c;
		}
		for (int i = 0; i < N; i++)edge[i][i] = 0;
		vector<int>node(K);
		vector<int>cost(K);
		for (int i = 0; i < K; i++) {
			cin >> node[i] >> cost[i];
			node[i]--;
		}
		L--;
		node.push_back(L);
		cost.push_back(0);
		K++;
		for (int k = 0; k < N; k++) {
			for (int i = 0; i < N; i++) {
				for (int j = 0; j < N; j++) {
					edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j]);
				}
			}
		}
		vector<vector<int>>dp(1 << K, vector<int>(K, MOD));
		dp[0][K - 1] = 0;
		dp[1 << (K - 1)][K - 1] = 0;
		for (int i = 0; i < 1 << K; i++) {
			for (int j = 0; j < K; j++) {
				for (int k = 0; k < K; k++) {
					if ((i >> k) & 1)continue;
					dp[i | (1 << k)][k] = min(dp[i | (1 << k)][k], dp[i][j] + edge[node[j]][node[k]] + cost[k]);
				}
			}
		}
		//for (int i = 0; i < 1 << K; i++) {
		//	for (int j = 0; j < K; j++) {
		//		cout << i << " " << j << " " << dp[i][j] << endl;
		//	}
		//}
		int ans = 0;
		for (int i = 1 << (K - 1); i < 1 << K; i++) {
		//	cout << dp[i][K - 1] << endl;
			if (dp[i][K - 1] <= T) {
				int box = i;
				int num = 0;
				while (box) {
					num += box & 1;
					box >>= 1;
				}
				ans = max(ans, num - 1);
			}
		}
		cout << ans << endl;
	}
}
