F. Falatro
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Falatro is a card game that has recently become very popular.

It is played with a nearly standard deck of cards, and the objective is to form a sequence of cards with the highest possible score, following some rules similar to poker. The difference in Falatro is that, in addition to the cards you have, you can buy jokers that can be used as modifiers to increase the score of your hand, depending on your hand.

Curious about the development of the game, John decided to include his own joker in the list of cards, the fidojoker. The rules for this joker are as follows: "All the cards in your hand will have paired trust relationships between them, and the score of your hand will be calculated as the sum, for each card, of the size of the smallest trust cycle that contains that card multiplied by its index." A trust relationship is formed by a pair of cards (A, B), where A trusts B and B trusts A. If a card does not participate in any trust cycle, it is considered to have size $$$1$$$.

Since John has difficulty thinking before playing, and he is not very good at math, he asked for your help to determine the score of his hand using the fidojoker.

Input

The input consists of a single test case. The first line of the input contains two integers $$$N$$$ $$$(3 \leq N \leq 100)$$$ and $$$M$$$ $$$(2 \leq M \leq \frac{N \cdot (N-1)}{2})$$$, representing the number of cards in John's hand and the number of trust relationships between the cards, respectively. The next $$$M$$$ lines contain two integers $$$A$$$ and $$$B$$$ $$$(1 \leq A, B \leq N,\ A \neq B)$$$, indicating that cards $$$A$$$ and $$$B$$$ have a trust relationship between them. It is guaranteed that there are no multiple relationships between the same pair of cards.

Output

The output should contain a single integer, representing the total score of John's hand.

Examples
Input
4 4
1 2
2 3
1 3
4 1
Output
22
Input
6 6
2 4
4 6
4 1
6 3
5 1
3 1
Output
63
Note

In the first test case, the smallest cycle formed by the cards consists of $$$1$$$, $$$2$$$, and $$$3$$$. Additionally, card $$$4$$$ is not in any cycle. Thus, John's score is $$$1 \cdot 3 + 2 \cdot 3 + 3 \cdot 3 + 4 \cdot 1 = 22$$$.