#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;

const int inf=1<<20;

int main(void){
	int n,m,l,s,t;
	while(cin >> n >> m >> l >> s >> t,n){
		s--;
		int dist[310][310];
		rep(i,n)rep(j,n) dist[i][j]=i==j?0:inf;
		rep(i,m){
			int a,b,c;
			cin >> a >> b >> c;
			dist[a-1][b-1]=dist[b-1][a-1]=c;
		}

		rep(k,n)rep(i,n)rep(j,n) chmin(dist[i][j],dist[i][k]+dist[k][j]);
		

		int tsp[1<<16][16],d[16],e[16];
		rep(mask,1<<l)rep(i,l) tsp[mask][i]=inf;

		rep(i,l) cin >> d[i] >> e[i],d[i]--;
		rep(i,l) tsp[bit(i)][i]=dist[s][d[i]];
		rep(mask,1,1<<l)rep(i,l) if(mask&bit(i)){
			rep(j,l){
				if(mask&bit(j)) continue;
				chmin(tsp[mask|bit(j)][j],tsp[mask][i]+dist[d[i]][d[j]]);
			}
		}

		int ans=0;
		rep(mask,1,1<<l)rep(i,l){
			rep(j,l) if(mask&bit(j)) tsp[mask][i]+=e[j];
			tsp[mask][i]+=dist[d[i]][s];
			if(tsp[mask][i]<=t) chmax(ans,popcount(mask));
		}
		cout << ans << endl;
	}		
	return 0;
}