Add up the maximum unit-capacity flow between every pair of junctions in a graph where each junction joins at most three pipes.
Hard8GraphTreeBFSDFSNo attempts yetTime limit7sMemory limit512 MBYou have been hired to upgrade the orange juice transport system of an old fruit processing plant. The system is made of pipes and junctions. Every pipe is bidirectional and every pipe carries at most 1 liter per second. Pipes meet at junctions, and each junction joins at most three pipes. A junction itself has unlimited capacity. Junctions are numbered with the integers from 1 to n.
Before you propose an upgrade you have to analyse the current system. For two different junctions s and t, the s-t flow is the largest amount of juice, in liters per second, that can move through the system when a source is installed at junction s and a sink at junction t. In the system of the first sample input, the 1-6 flow is 3 and the 1-2 flow is 2.
Find the sum of the a-b flow over every pair of junctions a and b with a<b.
The first line contains two integers n and m (2≤n≤3000, 0≤m≤4500), the number of junctions and the number of pipes. Each of the next m lines contains two different integers a and b (1≤a,b≤n) describing a pipe that connects junction a and junction b.
Every junction is connected to at most three other junctions. Every pair of junctions is connected by at most one pipe.
Print a single integer, the sum of the a-b flow over every pair of junctions a and b with a<b.

