#codefestival2017qualbc. [code_festival_2017_qualb_c]3 Steps
[code_festival_2017_qualb_c]3 Steps
Problem Statement
Rng has a connected undirected graph with vertices. Currently, there are edges in the graph, and the -th edge connects Vertices and .
Rng will add new edges to the graph by repeating the following operation:
- Operation: Choose and such that Vertex can be reached by traversing exactly three edges from Vertex , and add an edge connecting Vertices and . It is not allowed to add an edge if there is already an edge connecting Vertices and .
Find the maximum possible number of edges that can be added.
Constraints
- The graph has no self-loops or multiple edges.
- The graph is connected.
Input
Input is given from Standard Input in the following format:
Output
Find the maximum possible number of edges that can be added.
Sample Input 1
Sample Output 1
If we add edges as shown below, four edges can be added, and no more.
Sample Input 2
Sample Output 2
Five edges can be added, for example, as follows:
- Add an edge connecting Vertex and Vertex .
- Add an edge connecting Vertex and Vertex .
- Add an edge connecting Vertex and Vertex .
- Add an edge connecting Vertex and Vertex .
- Add an edge connecting Vertex and Vertex .