#include <iostream>
#include <algorithm>
#define inf 1000000000

using namespace std;

int n, m, l, S, t;
int g[305][305];
int p[20], e[20];
int G[20][20];

int dp[1<<17][20];

void WarshallFloyd()
{
	for(int k = 1; k <= n; k++){
		for(int i = 1; i <= n; i++){
			for(int j = 0; j <= n; j++){
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}
}


int count(int s)
{
	int ret = 0;
	for(;s;s >>= 1) if(s&1) ret++;
	return ret;
}

int main(void)
{
	while(1){
		cin >> n >> m >> l >> S >> t;
		if(n == 0 && m == 0 && l == 0 && S == 0 && t == 0) break;
		
		for(int i = 1; i <= n; i++){
			for(int j = 0; j <= n; j++){
				g[i][j] = inf;
			}
		}
		
		int a, b, c;
		for(int i = 0; i < m; i++){
			cin >> a >> b >> c;
			g[a][b] = g[b][a] = c;
		}
		WarshallFloyd();
		
		p[0] = S, e[0] = 0;
		for(int i = 1; i <= l; i++){
			cin >> p[i] >> e[i];
		}
		
		for(int i = 0; i <= l; i++){
			for(int j = 0; j <= l; j++){
				G[i][j] = g[p[i]][p[j]];
			}
		}
		
		int N = 1 << l;
		for(int s = 0; s < N; s++){
			for(int j = 0; j <= n; j++){
				dp[s][j] = inf;
			}
		}
		dp[0][0] = 0;
		
		int next;
		for(int s = 0; s < N; s++){
			for(int j = 0; j <= l; j++){
				dp[s][0] = min(dp[s][0], dp[s][j] + G[j][0]);
				for(int k = 1; k <= l; k++){
					if(s & (1 << (k-1))) continue;
					next = s | (1 << (k-1));
					dp[next][k] = min(dp[next][k], dp[s][j] + G[j][k] + e[k]);
				}
			}
			
			for(int k = 1; k <= l; k++){
				if(s & (1 << (k-1))) continue;
				next = s | (1 << (k-1));
				dp[next][k] = min(dp[next][k], dp[s][0] + G[0][k] + e[k]);
			}
		}
		
		int ans = 0;
		for(int s = 0; s < N; s++){
			if(dp[s][0] <= t) ans = max(ans, count(s));
		}
		cout << ans << endl;
	}
	
	return 0;
}