atcoder#ABC248F. [ABC248F] Keep Connect
[ABC248F] Keep Connect
Score : points
Problem Statement
You are given an integer greater than or equal to and a prime . Consider the graph with vertices and edges shown in the figure below.
More specifically, the edges connect the vertices as follows, where the vertices are labeled as Vertex , Vertex , , Vertex , and the edges are labeled as Edge , Edge , , Edge .
- For each , Edge connects Vertex and Vertex .
- For each , Edge connects Vertex and Vertex .
- For each , Edge connects Vertex and Vertex .
For each , solve the following problem.
Find the number of ways, modulo , to remove exactly of the edges of so that the resulting graph is still connected.
Constraints
- is an integer.
- is a prime.
Input
Input is given from Standard Input in the following format:
Output
Print integers, the -th of which is the answer for , separated by spaces.
3 998244353
7 15
In the case , there are ways, shown below, to remove exactly one edge so that the resulting graph is still connected.
There are ways, shown below, to remove exactly two edges so that the resulting graph is still connected.
Thus, these numbers modulo should be printed: and , in this order.
16 999999937
46 1016 14288 143044 1079816 6349672 29622112 110569766 330377828 784245480 453609503 38603306 44981526 314279703 408855776
Be sure to print the numbers modulo .