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;
int e[2100][2100], E[2100][2100], dfn[2100], mark[2100], nn, td, ct[2100],
    low[2100], sta[2100], fa[2100];
int dg[2100], dl[2100], n, m;
void dfs(int v) {
  sta[++sta[0]] = v;
  dfn[v] = ++td;
  low[v] = dfn[v];
  for (int j = (1); j <= (e[v][0]); j++) {
    int y = e[v][j];
    if (y == fa[v]) continue;
    if (dfn[y]) {
      if (!mark[y] && dfn[y] < low[v]) low[v] = dfn[y];
    } else {
      fa[y] = v;
      dfs(y);
      if (low[y] < low[v]) low[v] = low[y];
    }
  }
  if (low[v] == dfn[v]) {
    ct[++nn] = 0;
    while (sta[sta[0]] != v) {
      ct[nn]++;
      mark[sta[sta[0]--]] = nn;
    }
    ct[nn]++;
    mark[sta[sta[0]--]] = nn;
  }
}
int tt, TT[2100], ba, tp, ans;
void dd(int v) {
  TT[v] = 0;
  for (int i = (1); i <= (E[v][0]); i++) {
    int y = E[v][i];
    if (y == fa[v]) continue;
    fa[y] = v;
    dd(y);
    TT[v] += TT[y];
  }
  tp += TT[v] * ct[v];
  TT[v] += ct[v];
}
int f[2200];
void deal(int v) {
  tp = ct[v] * (tt - ct[v]);
  memset(fa, 0, sizeof(fa));
  dl[0] = 0;
  for (int i = (1); i <= (E[v][0]); i++) {
    fa[E[v][i]] = v;
    dd(E[v][i]);
    dl[++dl[0]] = E[v][i];
  }
  for (int i = (0); i <= (2100); i++) f[i] = 0;
  f[0] = 1;
  for (int i = (1); i <= (dl[0]); i++) {
    for (int j = (2100); j >= (TT[dl[i]]); j--) f[j] |= f[j - TT[dl[i]]];
  }
  int ma = 0;
  for (int i = (0); i <= (2100); i++)
    if (f[i]) ma = max(ma, (tt - ct[v] - i) * i);
  if (ma + tp > ans) ans = ma + tp;
}
int main() {
  memset(mark, 0, sizeof(mark));
  memset(dfn, 0, sizeof(dfn));
  memset(sta, 0, sizeof(sta));
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (m); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x][++e[x][0]] = y;
    e[y][++e[y][0]] = x;
  }
  td = nn = 0;
  sta[0] = 0;
  for (int i = (1); i <= (n); i++)
    if (dfn[i] == 0) dfs(i);
  for (int i = (1); i <= (nn); i++) E[i][0] = 0;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (e[i][0]); j++) {
      int a = mark[i], b = mark[e[i][j]];
      if (a == b) continue;
      E[a][++E[a][0]] = b;
    }
  tt = n;
  n = nn;
  memset(fa, 0, sizeof(fa));
  ans = 0;
  int ba = 0;
  for (int i = (1); i <= (n); i++) ba += (ct[i] * ct[i]);
  for (int i = (1); i <= (n); i++) deal(i);
  cout << ans + ba << endl;
}
