atcoder#ABC281G. [ABC281G] Farthest City
[ABC281G] Farthest City
Score : points
Problem Statement
You are given positive integers and . Find the number, modulo , of simple connected undirected graphs with vertices numbered that satisfy the following condition.
- For every , the shortest distance from vertex to vertex is strictly smaller than the shortest distance from vertex to vertex .
Here, the shortest distance from vertex to vertex is the minimum number of edges in a simple path connecting vertices and . Two graphs are considered different if and only if there are two vertices and that are connected by an edge in exactly one of those graphs.
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
4 1000000000
8
The following eight graphs satisfy the condition.
3 100000000
1
500 987654321
610860515
Be sure to find the number modulo .