#P10953. Unavoidable Roads

    ID: 13001 Type: Default 1000ms 256MiB

Unavoidable Roads

Unavoidable Roads

In modern society, roads are indispensable. There are \( n \) towns and \( m \) roads. Every pair of distinct towns is connected by at least one road (often by more than one). However, some roads have fallen into disrepair and are unpleasant to travel on.

Ideally, "all roads lead to Rome" and one may always choose an alternative route. But Xiao Lu discovered something interesting: between two given towns \( a \) and \( b \), no matter which route is taken, there are certain roads that must be passed. Such a road is called an unavoidable road for the pair \( (a, b) \).

Your task is to count how many roads are unavoidable, i.e. roads that appear in every path from \( a \) to \( b \).

Note: A road is considered unavoidable if after removing it from the network the towns \( a \) and \( b \) become disconnected. Also, if there are multiple roads between the same pair of towns, none of those roads is unavoidable since one can always take an alternative road between those two towns.

inputFormat

The first line contains four integers \( n, m, a, b \) (number of towns, number of roads, starting town, and destination town respectively).

Each of the next \( m \) lines contains two integers \( u \) and \( v \) indicating that there is a road between town \( u \) and town \( v \).

You may assume that \( 1 \leq a, b \leq n \) and \( 1 \leq u, v \leq n \), and that every pair of towns is connected by at least one road.

outputFormat

Output a single integer: the number of unavoidable roads from town \( a \) to town \( b \).

sample

4 4 1 4
1 2
2 4
1 3
3 4
0