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 first[110000], nxt[4100000], vv[4100000], low[110000], ran[110000];
int sta[110000], ind, C, top;
int fa[110000], ff[110000], bel[110000];
int dep[110000], ss[2100];
void dfs(int n, int ee) {
  low[n] = ran[n] = ++ind;
  sta[++top] = n;
  int e, v, u;
  for (e = first[n]; e; e = nxt[e])
    if (e - ee) {
      v = vv[e];
      if (!ran[v]) {
        dfs(v, e ^ 1);
        if (low[v] > ran[n]) {
          C++;
          do {
            u = sta[top--];
            bel[u] = C;
            ss[C]++;
          } while (v - u);
        } else
          low[n] = low[n] < low[v] ? low[n] : low[v];
      } else
        low[n] = low[n] < ran[v] ? low[n] : ran[v];
    }
}
int is[2100][2100];
int nis[2100][2100];
int gao(int n, int m) {
  int i, j, k;
  for (i = 1; i <= n; i++)
    if (!ran[i]) {
      dfs(i, 0);
      if (top) {
        C++;
        do {
          int u = sta[top--];
          bel[u] = C;
          ss[C]++;
        } while (top);
      }
    }
  int e = 2;
  memset(first, 0, sizeof(first));
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (is[i][j]) {
        if (bel[i] - bel[j]) {
          int ii = bel[i];
          int jj = bel[j];
          if (nis[ii][jj] == 0) {
            nis[ii][jj] = nis[jj][ii] = 1;
            nxt[e] = first[ii], vv[e] = jj, first[ii] = e++;
            nxt[e] = first[jj], vv[e] = ii, first[jj] = e++;
          }
        }
      }
  return C;
}
int dp[2100], siz[2100];
int solve(int n, int f) {
  dp[n] = 0;
  siz[n] = ss[n];
  for (int e = first[n]; e; e = nxt[e])
    if (vv[e] - f) {
      solve(vv[e], n);
      siz[n] += siz[vv[e]];
      dp[n] += siz[vv[e]] * ss[n] + dp[vv[e]];
    }
  return dp[n];
}
int mm;
int can[2100];
int N;
int getans(int n, int r) {
  int ret = solve(r, 0);
  memset(can, 0, sizeof(can));
  int i, j, k;
  can[0] = 1;
  for (int e = first[r]; e; e = nxt[e])
    for (i = N; i >= 0; i--)
      if (can[i]) can[i + siz[vv[e]]] = 1;
  int M = 0;
  for (i = 0; i < N; i++)
    if (can[i]) M = max(M, i * (N - ss[r] - i));
  return M + ret;
}
int main() {
  int n, m, i, j, k;
  int nn;
  int u, v, e = 2;
  scanf("%d%d", &n, &m);
  nn = n;
  mm = m;
  N = n;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    nxt[e] = first[u], vv[e] = v, first[u] = e++;
    nxt[e] = first[v], vv[e] = u, first[v] = e++;
    is[u][v] = is[v][u] = 1;
  }
  n = gao(n, m);
  int ans = 0;
  nn = 0;
  for (i = 1; i <= n; i++) ans = max(ans, getans(n, i));
  for (i = 1; i <= n; i++) nn += ss[i] * ss[i];
  printf("%d\n", ans + nn);
}
