Imagine a city with n junctions and m streets. Junctions are numbered from 1 to n.

In order to increase the traffic flow, mayor of the city has decided to make each street one-way. This means in the street between junctions u and v, the traffic moves only from u to v or only from v to u. 

The problem is to direct the traffic flow of streets in a way that maximizes the number of pairs (u, v) where 1 ≤ u, v ≤ n and it is possible to reach junction v from u by passing the streets in their specified direction. Your task is to find out maximal possible number of such pairs.

Input

The first line of input contains integers n and m, (<image>), denoting the number of junctions and streets of the city.

Each of the following m lines contains two integers u and v, (u ≠ v), denoting endpoints of a street in the city.

Between every two junctions there will be at most one street. It is guaranteed that before mayor decision (when all streets were two-way) it was possible to reach each junction from any other junction.

Output

Print the maximal number of pairs (u, v) such that that it is possible to reach junction v from u after directing the streets.

Examples

Input

5 4
1 2
1 3
1 4
1 5


Output

13


Input

4 5
1 2
2 3
3 4
4 1
1 3


Output

16


Input

2 1
1 2


Output

3


Input

6 7
1 2
2 3
1 3
1 4
4 5
5 6
6 4


Output

27

Note

In the first sample, if the mayor makes first and second streets one-way towards the junction 1 and third and fourth streets in opposite direction, there would be 13 pairs of reachable junctions: {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (2, 1), (3, 1), (1, 4), (1, 5), (2, 4), (2, 5), (3, 4), (3, 5)}
#include <bits/stdc++.h>
using namespace std;
int64_t n, m, sum, cnt = 0, Num[2005], Low[2005], Free[2005], Pre[2005],
                   C[2005], Child[2005];
bool f[2005], FEdge[2000000];
vector<int64_t> gg[2005];
vector<pair<int64_t, int64_t> > Edge, g[2005];
void DFS(int64_t u, int64_t root) {
  Num[u] = Low[u] = ++cnt;
  for (int64_t i = 0; i < g[u].size(); i++) {
    int64_t v = g[u][i].first;
    int64_t id = g[u][i].second;
    if (Num[v] == 0) {
      DFS(v, u);
      Low[u] = min(Low[u], Low[v]);
      if (Low[v] >= Num[v]) {
        FEdge[id] = true;
        Edge.push_back(pair<int64_t, int64_t>(u, v));
      }
    } else if (v != root)
      Low[u] = min(Low[u], Num[v]);
  }
}
void NumDFS(int64_t u, int64_t kk) {
  Pre[u] = kk;
  C[kk]++;
  for (int64_t i = 0; i < g[u].size(); i++) {
    int64_t v = g[u][i].first;
    int64_t id = g[u][i].second;
    if (FEdge[id] == false && Pre[v] == 0) NumDFS(v, kk);
  }
}
void ChildDFS(int64_t u, int64_t root) {
  Child[u] = C[u];
  for (int64_t i = 0; i < gg[u].size(); i++)
    if (gg[u][i] != root) {
      ChildDFS(gg[u][i], u);
      Child[u] += Child[gg[u][i]];
      sum += C[u] * Child[gg[u][i]];
    }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  int64_t u, v, Count = 0, maxn = 0, res = 0;
  for (int64_t i = 1; i <= m; i++) {
    cin >> u >> v;
    g[u].push_back(pair<int64_t, int64_t>(v, i));
    g[v].push_back(pair<int64_t, int64_t>(u, i));
  }
  for (int64_t i = 1; i <= n; i++)
    if (Num[i] == 0) DFS(i, i);
  for (int64_t i = 1; i <= n; i++)
    if (Pre[i] == 0) {
      NumDFS(i, ++Count);
      res += C[Count] * C[Count];
    }
  for (int64_t i = 0; i < Edge.size(); i++) {
    int64_t u = Pre[Edge[i].first];
    int64_t v = Pre[Edge[i].second];
    gg[u].push_back(v);
    gg[v].push_back(u);
  }
  for (int64_t i = 1; i <= Count; i++) {
    f[0] = true;
    for (int64_t j = 1; j <= n; j++) f[j] = false;
    sum = 0;
    for (int64_t j = 0; j < gg[i].size(); j++) {
      int64_t u = gg[i][j];
      ChildDFS(u, i);
      Child[i] += Child[u];
      for (int64_t t = n; t >= Child[u]; t--) f[t] |= f[t - Child[u]];
    }
    int64_t maxx = 0;
    for (int64_t j = 0; j <= n - C[i]; j++)
      if (f[j] == true)
        maxx = max(maxx, j * (n - j - C[i]) + (n - C[i]) * C[i]);
    maxn = max(maxn, sum + maxx);
  }
  cout << res + maxn;
}
