Problem: Problem Statement

You are now participating in the Summer Training Camp for Programming Contests with your friend Jiro, who is an enthusiast of the ramen chain SIRO. Since every SIRO restaurant has its own tasteful ramen, he wants to try them at as many different restaurants as possible in the night. He doesn't have plenty of time tonight, however, because he has to get up early in the morning tomorrow to join a training session. So he asked you to find the maximum number of different restaurants to which he would be able to go to eat ramen in the limited time.

There are $n$ railway stations in the city, which are numbered $1$ through $n$. The station $s$ is the nearest to the camp venue. $m$ pairs of stations are directly connected by the railway: you can move between the stations $a_i$ and $b_i$ in $c_i$ minutes in the both directions. Among the stations, there are $l$ stations where a SIRO restaurant is located nearby. There is at most one SIRO restaurant around each of the stations, and there are no restaurants near the station $s$. It takes $e_i$ minutes for Jiro to eat ramen at the restaurant near the station $j_i$.

It takes only a negligibly short time to go back and forth between a station and its nearby SIRO restaurant. You can also assume that Jiro doesn't have to wait for the ramen to be served in the restaurants.

Jiro is now at the station $s$ and have to come back to the station in $t$ minutes. How many different SIRO's can he taste?

Input

The input is a sequence of datasets. The number of the datasets does not exceed $100$. Each dataset is formatted as follows:

> $n$ $m$ $l$ $s$ $t$
> $a_1$ $b_1$ $c_1$
> :
> :
> $a_m$ $b_m$ $c_m$
> $j_1$ $e_1$
> :
> :
> $j_l$ $e_l$

The first line of each dataset contains five integers:

* $n$ for the number of stations,

* $m$ for the number of directly connected pairs of stations,

* $l$ for the number of SIRO restaurants,

* $s$ for the starting-point station, and

* $t$ for the time limit for Jiro.




Each of the following $m$ lines contains three integers:

* $a_i$ and $b_i$ for the connected stations, and

* $c_i$ for the time it takes to move between the two stations.




Each of the following $l$ lines contains two integers:

* $j_i$ for the station where a SIRO restaurant is located, and

* $e_i$ for the time it takes for Jiro to eat at the restaurant.




The end of the input is indicated by a line with five zeros, which is not included in the datasets.

The datasets satisfy the following constraints:

* $2 \le n \le 300$

* $1 \le m \le 5{,}000$

* $1 \le l \le 16$

* $1 \le s \le n$

* $1 \le t \le 100{,}000$

* $1 \le a_i, b_i \le n$

* $1 \le c_i \le 1{,}000$

* $1 \le j_i \le n$

* $1 \le e_i \le 15$

* $s \ne j_i$

* $j_i$'s are distinct.

* $a_i \ne b_i$

* $(a_i, b_i) \ne (a_j, b_j)$ and $(a_i, b_i) \ne (b_j, a_j)$ for any $i \ne j$




Note that there may be some stations not reachable from the starting point $s$.

Output

For each data set, output the maximum number of different restaurants where Jiro can go within the time limit.

Sample Input


2 1 1 1 10
1 2 3
2 4
2 1 1 1 9
1 2 3
2 4
4 2 2 4 50
1 2 5
3 4 5
2 15
3 15
4 6 3 1 29
1 2 20
3 2 10
4 1 5
3 1 5
2 4 3
3 4 4
2 1
4 5
3 3
0 0 0 0 0

Output for the Sample Input


1
0
1
3





Example

Input

2 1 1 1 10
1 2 3
2 4
2 1 1 1 9
1 2 3
2 4
4 2 2 4 50
1 2 5
3 4 5
2 15
3 15
4 6 3 1 29
1 2 20
3 2 10
4 1 5
3 1 5
2 4 3
3 4 4
2 1
4 5
3 3
0 0 0 0 0


Output

1
0
1
3

Solution (in CPP):

Solution:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <bitset>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int bitcount(int x){
  int ret = 0;
  while(x){
    ret += x&1;
    x >>= 1;
  }
  return ret;
}

struct Edge{
  int to, cost;
  Edge(int a, int b){
    to = a;
    cost = b;
  }
};

int N, M, L, S, T;
//vector<Edge>G[305];
int dp[1<<16][16];
int G[300][300];
int jiro[16];
int eat[16];

int main()
{
  while(1){
    cin >> N >> M >> L >> S >> T; 
    if(N == 0 && M == 0 && L == 0 && S == 0 && T == 0) break;
    S--;
  rep(i, N) rep(j, N) G[i][j] = INF;
  rep(i, N) G[i][i] = 0;
  for(int i=0;i<M;i++){
    int a, b, c; cin >> a >> b >> c; a--; b--;
    //    G[a].push_back(Edge(b, c));
    //    G[b].push_back(Edge(a, c));
    G[a][b] = G[b][a] = c;
  }

  rep(i, L){
    cin >> jiro[i] >> eat[i]; jiro[i]--;
  }

  rep(k, N) G[k][k] = 0;
  rep(k, N) rep(i, N) rep(j, N){
    G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
  }

  for(int i=0;i<1<<16;i++) for(int j=0;j<16;j++) dp[i][j] = INF;
  for(int i=0;i<L;i++) dp[1<<i][i] = G[S][jiro[i]] + eat[i];
  for(int i=0;i<1<<L;i++){
    for(int j=0;j<L;j++){
      for(int k=0;k<L;k++){
	dp[i|(1<<k)][k] = min(dp[i|(1<<k)][k], dp[i][j] + G[jiro[j]][jiro[k]] + eat[k]);
	//	if(dp[i|(1<<k)][k] != INF){
	//	  cout << bitset<16>(i|(1<<k)) << " " << k << " " << dp[i|(1<<k)][k] << endl;
	  //	}
      }
    }
  }
  int ret = 0;
  for(int i=0;i<1<<L;i++){
    for(int j=0;j<L;j++){
      if(dp[i][j] + G[jiro[j]][S] <= T){
	//	cout << bitset<16>(i) << " " << j << " " << " " << jiro[j] << " " << S <<" " << dp[i][j] << " " <<  G[jiro[j]][S] << endl;      
	ret = max(ret, bitcount(i));
      }
    }
  }

  cout << ret << endl;
  }
  return 0;
}