This page is still under construction.

Parts of this page are still being built. What you see may change.

Minus One

Time limit2sMemory limit512 MB

Summary
Count the non-edges whose addition shortens the shortest s-t path by exactly one, given an undirected graph with up to 100,000 vertices.
Level

Medium7 of 10

Topics
Graph, BFS, Shortest path, Combinatorics
Solved
No attempts yet

Problem

Ikuta is unusually attached to undirected graphs. Among pairs (G,s,t)(G,s,t) consisting of an undirected graph GG and two of its vertices s,ts,t, he likes the ones with large "beauty". The "beauty" of a pair (G,s,t)(G,s,t) is the number of edges e={u,v}e = \{u, v\} (uu and vv are two distinct vertices of GG) such that the length of the shortest path from ss to tt in GG is exactly 1 greater than the length of the shortest path from ss to tt in the undirected graph obtained by adding ee to GG.

Your job is to write a program that computes this "beauty" for a given pair (G,s,t)(G,s,t).

Input

The input is given in the following format.

NN MM ss tt

x1x_1 y1y_1

...

xix_i yiy_i

...

xMx_M yMy_M

First, the integers N,M,s,tN,M,s,t, which denote the number of vertices of the undirected graph, the number of edges, and two vertices, are given. Lines 2 through M+1M+1 each give two vertices connected by an edge. (The vertex set of GG is {1,...,N}\{1,..., N\}.)

Output

Let the given graph be GG. Print the "beauty" of the pair (G,s,t)(G,s,t) on one line.

Constraints

Each variable in the input satisfies the following constraints.

  • 2≤N≤100,0002\leq N \leq 100,000

  • 1≤M≤300,0001\leq M \leq 300,000

  • 1≤s,t,xi,yi≤N1\leq s,t,x_i,y_i \leq N

  • ss and tt are different

  • It is guaranteed that tt is reachable from ss

Examples4

  1. Example 1

    Input
    3 2 1 3
    1 2
    2 3
    
    Expected output
    1
    
  2. Example 2

    Input
    9 8 7 8
    2 6
    4 9
    8 6
    9 2
    3 8
    1 8
    8 5
    7 9
    
    Expected output
    7
    
  3. Example 3

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

    Input
    9 7 8 9
    9 6
    6 5
    3 6
    3 7
    2 5
    8 5
    1 4
    
    Expected output
    2