#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <bitset>
#define INF 0x3f3f3f3f
#define eps 1e-8
#define FI first
#define SE second
using namespace std;
typedef long long LL;
int G[305][305];
int D[20][20],siro[20],cost[20];
int dp[17][1<<16],bit[1<<16];
bool done[17][1<<16];
struct node
{
    int u,st,dis;
    inline node(int _u=0,int _st=0,int _dis=0)
    {
        u=_u; st=_st; dis=_dis;
    }
    inline bool operator <(const node &a)const
    {
        return dis>a.dis;
    }
};
priority_queue <node> Q;

inline void Dijkstra(int n,int t)
{
    memset(dp,0x3f,sizeof(dp));
    memset(done,0,sizeof(done));
    dp[0][0]=0;
    Q.push(node(0,0,0));
    node u;
    while(!Q.empty())
    {
        u=Q.top(); Q.pop();
        if(done[u.u][u.st]) continue;
        done[u.u][u.st]=1;
        for(int i=1;i<=n;++i) if(D[u.u][i]!=INF)
        {
            if(u.st&(1<<(i-1))) continue;
            int v=u.dis+D[u.u][i]+cost[i];
            if(v+D[0][i]>t) continue;
            int nst=u.st|(1<<(i-1));
            if(dp[i][nst]>v)
            {
                dp[i][nst]=v;
                Q.push(node(i,nst,v));
            }
        }
    }
    int res=0;
    for(int i=1;i<=n;++i)
        for(int j=(1<<n)-1;j>=0;--j)
            if(dp[i][j]+D[0][i]<=t) res=max(res,bit[j]);
    printf("%d\n",res);
}

inline int bit_count(int st)
{
    int res=0;
    for(;st;st^=st&-st) ++res;
    return res;
}

int main()
{
    for(int i=(1<<16)-1;i>=0;--i) bit[i]=bit_count(i);
    int n,m,l,s,t;
    while(scanf("%d%d%d%d%d",&n,&m,&l,&s,&t)&&n)
    {
        for(int i=1;i<=n;++i) for(int j=1;j<=n;++j) G[i][j]=INF;
        while(m--)
        {
            int u,v,w;
            scanf("%d%d%d",&u,&v,&w);
            G[u][v]=G[v][u]=w;
        }
        for(int k=1;k<=n;++k)
            for(int i=1;i<=n;++i)
                for(int j=1;j<=n;++j)
                {
                    if(k==i||k==j||i==j) continue;
                    G[i][j]=min(G[i][j],G[i][k]+G[k][j]);
                }
        for(int i=1;i<=l;++i) scanf("%d%d",siro+i,cost+i);
        siro[0]=s;
        memset(D,0x3f,sizeof(D));
        for(int i=0;i<=l;++i)
            for(int j=i+1;j<=l;++j)
                D[i][j]=D[j][i]=G[siro[i]][siro[j]];
        Dijkstra(l,t);
    }
    return 0;
}