100 atcoder#ABC212E. [ABC212E] Safety Journey
[ABC212E] Safety Journey
Score : points
Problem Statement
The Republic of AtCoder has cities, called City , City , , City . Initially, there was a bidirectional road between every pair of different cities, but of these roads have become unusable due to deterioration over time. More specifically, for each , the road connecting City and City has become unusable.
Takahashi will go for a -day trip that starts and ends in City . Formally speaking, a -day trip that starts and ends in City is a sequence of cities such that holds and for each , and are different and there is still a usable road connecting City and City .
Print the number of different -day trips that start and end in City , modulo . Here, two -day trips and are said to be different when there exists an such that .
Constraints
- $0 \leq M \leq \min\left( \frac{N(N-1)}{2},5000 \right)$
- $1 \leq U_i
- All pairs are pairwise distinct.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3 1 4
2 3
4
There are four different trips as follows.
- ()
- ()
- ()
- ()
No other trip is valid, so we should print .
3 3 3
1 2
1 3
2 3
0
No road remains usable, so there is no valid trip.
5 3 100
1 2
4 5
2 3
428417047