human
Give me a Python code to print the single number — the number of Super Duper Secret Missile Silos that are located in Berland given the following:
A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missiles. The exact position of the Super Duper Secret Missile Silos is kept secret but Bob managed to get hold of the information. That information says that all silos are located exactly at a distance l from the capital. The capital is located in the city with number s.

The documents give the formal definition: the Super Duper Secret Missile Silo is located at some place (which is either city or a point on a road) if and only if the shortest distance from this place to the capital along the roads of the country equals exactly l.

Bob wants to know how many missile silos are located in Berland to sell the information then to enemy spies. Help Bob.

Input

The first line contains three integers n, m and s (2 ≤ n ≤ 105, , 1 ≤ s ≤ n) — the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. 

Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1 ≤ vi, ui ≤ n, vi ≠ ui, 1 ≤ wi ≤ 1000), where vi, ui are numbers of the cities connected by this road and wi is its length. The last input line contains integer l (0 ≤ l ≤ 109) — the distance from the capital to the missile silos. It is guaranteed that: 

  * between any two cities no more than one road exists.

  * each road connects two different cities.

  * from each city there is at least one way to any other city by the roads. 

Output

Print the single number — the number of Super Duper Secret Missile Silos that are located in Berland.

Examples

Input

4 6 1
1 2 1
1 3 3
2 3 1
2 4 1
3 4 1
1 4 2
2

Output

3

Input

5 6 3
3 1 1
3 2 1
3 4 1
3 5 1
1 2 6
4 5 8
4

Output

3

Note

In the first sample the silos are located in...
assistant
#Here is Python code to print the single number — the number of Super Duper Secret Missile Silos that are located in Berland.

from sys import stdin
from heapq import heappush, heappop

INF = 2 * 10 ** 9

def dijkstra(graph, n, s):
    d = [INF] * n
    d[s] = 0

    # class VertexIndex(int):
    #     def __cmp__(self, other):
    #         return cmp(d[self], d[other])

    q = []
    heappush(q, (0, s))
    while q:
        tmp_d, v = heappop(q)
        dv = d[v]
        if tmp_d != dv:
            continue
        graph_v = graph[v]
        for to, w in graph_v:
            if dv + w < d[to]:
                d[to] = dv + w
                heappush(q, (d[to], to))
    return d

def main():
    next_line = stdin.readline
    n, m, s = map(int, next_line().split())
    s -= 1
    graph = [[] for _ in range(n)]

    def init(i):
        line = next_line().split()
        v = int(line[0]) - 1
        u = int(line[1]) - 1
        w = int(line[2])
        graph[v].append([u, w])
        graph[u].append([v, w])
        return v, u, w

    edges = list(map(init, range(m)))

    # for i in range(m):
    #     line = next_line().split()
    #     v = int(line[0]) - 1
    #     u = int(line[1]) - 1
    #     w = int(line[2])
    #     graph[v].append([u, w])
    #     graph[u].append([v, w])
    #     edges[i] = (v, u, w)
    l = int(next_line())
    ds = dijkstra(graph, n, s)

    def calc(edge):
        v, u, w = edge
        dv = ds[v]
        du = ds[u]
        res = 0
        if dv < l < dv + w and du + w - (l - dv) > l:
            res += 1
        if du < l < du + w and dv + w - (l - du) > l:
            res += 1
        if dv < l and du < l and dv + du + w == 2 * l:
            res += 1
        return res

    res = sum(d == l for d in ds) + sum(map(calc, edges))
    print(res)

if __name__ == '__main__':
    main()