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;
const int M = 2010;
vector<int> A[M], G[M], S[M];
bool visited[M], ok[M][M];
int disc[M], low[M], parent[M], Size[M], n;
int subtr[M], dp[M];
void find_bridges(int u) {
  static int time = 0;
  visited[u] = true;
  disc[u] = low[u] = ++time;
  int i, v;
  for (i = 0; i < A[u].size(); i++) {
    v = A[u][i];
    if (!visited[v]) {
      parent[v] = u;
      find_bridges(v);
      low[u] = min(low[u], low[v]);
      if (low[v] > disc[u]) {
        ok[u][v] = ok[v][u] = false;
      }
    } else if (v != parent[u])
      low[u] = min(low[u], disc[v]);
  }
}
void dfs(int u, int p) {
  visited[u] = true;
  parent[u] = p;
  Size[p]++;
  for (int i = 0; i < A[u].size(); i++) {
    int v = A[u][i];
    if (visited[v] || !ok[u][v]) continue;
    dfs(v, p);
  }
}
int dfs2(int u, int up) {
  int sum = 0;
  visited[u] = true;
  subtr[u] = Size[u];
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (visited[v]) continue;
    sum += dfs2(v, up + Size[u]);
    subtr[u] += subtr[v];
  }
  return sum + Size[u] * up;
}
int main() {
  int m, i, j, k;
  memset((ok), (false), sizeof(ok));
  scanf("%d%d", &n, &m);
  while (m--) {
    scanf("%d%d", &i, &j);
    A[i].push_back(j);
    A[j].push_back(i);
    ok[i][j] = ok[j][i] = true;
  }
  memset((visited), (false), sizeof(visited));
  memset((parent), (-1), sizeof(parent));
  for (i = 1; i <= n; i++)
    if (!visited[i]) find_bridges(i);
  memset((visited), (false), sizeof(visited));
  memset((Size), (0), sizeof(Size));
  for (i = 1; i <= n; i++)
    if (!visited[i]) dfs(i, i);
  for (i = 1; i <= n; i++)
    for (j = 0; j < A[i].size(); j++)
      if (!ok[i][A[i][j]]) G[parent[i]].push_back(parent[A[i][j]]);
  int sum, maxx = 0;
  for (i = 1; i <= n; i++) {
    if (parent[i] == i) {
      memset((visited), (false), sizeof(visited));
      sum = dfs2(i, 0);
      memset((dp), (0), sizeof(dp));
      dp[0] = 1;
      for (j = 0; j < G[i].size(); j++) {
        k = subtr[G[i][j]];
        for (int l = n; l >= 0; l--)
          if (dp[l] == 1) dp[l + k] = 1;
      }
      int tempmax = 0;
      for (int l = 0; l < n; l++)
        if (dp[l] == 1) tempmax = max(tempmax, l * (n - l - Size[i]));
      maxx = max(maxx, tempmax + sum);
    }
  }
  for (i = 1; i <= n; i++)
    if (parent[i] == i) maxx += Size[i] * Size[i];
  printf("%d\n", maxx);
  return 0;
}
