PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#FW0000010. Đỉnh ở quá xa (A Node Too Far)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đỉnh ở quá xa (A Node Too Far)

A Node Too Far

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

In an undirected network, a message from node ss may traverse at most TT edges. Count nodes that cannot be reached within this limit; an absent source reaches none.

Input

mm undirected endpoint pairs followed by source ss and TTL TT.

Output

Print the number of unreachable nodes within TTL.

Subtasks

  • Subtask 1 (40 points): at most 1212 distinct network labels; 1≤m≤10001\le m\le 1000; 0≤T≤10000000000\le T\le 1000000000; 0≤u,v,s≤10000000000\le u,v,s\le 1000000000.
  • Subtask 2 (60 points): 1≤m≤10001\le m\le 1000; 0≤T≤10000000000\le T\le 1000000000; 0≤u,v,s≤10000000000\le u,v,s\le 1000000000.

Examples

Input

3
10 20
20 30
30 40
10 1

Output

2

Explanation

With TTL 11, only nodes 10 and 20 are reachable from 10; nodes 30 and 40 are not.