Under construction

Still being built. Things may change

Squawk Virus

Interview

Time limit1sMemory limit256 MB

Summary
Starting from user s, propagate squawk counts along links for t minutes and report how many squawks are sent at time t.
Level

Easy3 of 10

Topics
Dynamic programming, Graph
Solved
No attempts yet

Problem

The social networking site Twitface is under attack by a virus. The virus spreads from user to user and floods the network with traffic. Users normally send messages to each other by hand, and such a message is called a squawk, but an infected squawk copies itself with no user action.

A user who receives an infected squawk sends one infected squawk to every neighbor in the network exactly one minute later. If a user receives several squawks at the same moment, one minute later it sends that many squawks to each of its neighbors.

Consider the network below. User 0 is linked to users 1 and 3, and user 2 is linked to users 1, 3 and 4.

If user 0 is infected at time t=0t = 0, then at t=1t = 1 users 1 and 3 receive one squawk each, at t=2t = 2 users 0 and 2 receive two squawks each, and at t=3t = 3 users 1 and 3 receive four squawks each while user 4 receives two. The number of squawks sent at times 1, 2 and 3 is 2, 4 and 10.

You are given the layout of the network and the first infected user. Find how many squawks are sent at time tt. At t=0t = 0, count the single squawk that infected user ss.

Input

The first line has four integers nn, mm, ss, tt: the number of users (1≤n≤1001 \le n \le 100), the number of links between users (0≤m≤n(n−1)/20 \le m \le n(n-1)/2), the index of the first infected user (0≤s<n0 \le s < n), and the elapsed time in minutes (0≤t<100 \le t < 10).

Each of the next mm lines has two integers xx and yy (0≤x,y<n0 \le x, y < n), meaning that users xx and yy are linked. Links work in both directions, and no link is given twice.

Output

Print the number of squawks sent at time tt.

Examples2

  1. Example 1

    Input
    4 3 1 4
    0 1
    1 2
    2 3
    
    Expected output
    8
    
  2. Example 2

    Input
    5 5 0 3
    0 1
    0 3
    1 2
    2 3
    2 4
    
    Expected output
    10