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 N = 2005;
int n, m, pre[N], mcnt;
vector<pair<int, int> > E;
struct edge {
  int x, next;
} e[N * N * 2];
bool B[N * N];
int dfn[N], low[N], ncnt, bel[N];
int val[N], ans;
vector<int> V;
void dfs(int x, int fa) {
  dfn[x] = low[x] = ++ncnt;
  for (int i = pre[x]; ~i; i = e[i].next) {
    int y = e[i].x;
    if (!dfn[y]) {
      dfs(y, i ^ 1);
      low[x] = min(low[x], low[y]);
      if (low[y] > dfn[x]) B[i >> 1] = 1;
    } else if (i != fa && dfn[y] < dfn[x])
      low[x] = min(low[x], dfn[y]);
  }
}
void DFS(int x) {
  bel[x] = ncnt, ++val[ncnt];
  for (int i = pre[x]; ~i; i = e[i].next) {
    int y = e[i].x;
    if (!B[i >> 1] && !bel[y]) DFS(y);
  }
}
int cnt, sum, s[N], g[N];
void gfs(int x) {
  ++cnt, dfn[x] = 1, V.push_back(x);
  for (int i = pre[x]; ~i; i = e[i].next) {
    int y = e[i].x;
    if (!dfn[y]) gfs(y);
  }
}
void pfs(int x, int fa) {
  s[x] = val[x], g[x] = 0;
  for (int i = pre[x]; ~i; i = e[i].next) {
    int y = e[i].x;
    if (y != fa) {
      pfs(y, x);
      s[x] += s[y];
      g[x] += g[y];
      g[x] += s[y] * val[x];
    }
  }
}
int gao(vector<int>& A) {
  int S = 0, i, j;
  for (i = 0; i < A.size(); ++i) {
    S += A[i];
  }
  vector<bool> F(S + 1);
  F[0] = 1, S = 0;
  for (i = 0; i < A.size(); ++i) {
    int x = A[i];
    S += A[i];
    for (j = S; j >= x; --j) F[j] = F[j] | F[j - x];
  }
  int res = 0;
  for (i = 0; i <= S; ++i)
    if (F[i]) res = max(res, i * (S - i));
  return res;
}
int main() {
  int i, k, x, y;
  scanf("%d%d", &n, &m);
  memset(pre, -1, sizeof(pre));
  for (i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    E.push_back(make_pair(x, y));
    e[mcnt] = (edge){y, pre[x]}, pre[x] = mcnt++;
    e[mcnt] = (edge){x, pre[y]}, pre[y] = mcnt++;
  }
  for (i = 1; i <= n; ++i)
    if (!dfn[i]) dfs(i, -1);
  ncnt = 0;
  for (i = 1; i <= n; ++i)
    if (!bel[i]) {
      ++ncnt;
      DFS(i);
    }
  memset(pre, -1, sizeof(pre)), mcnt = 0;
  for (i = 0; i < m; ++i) {
    x = E[i].first, y = E[i].second;
    x = bel[x], y = bel[y];
    if (x != y) {
      e[mcnt] = (edge){y, pre[x]}, pre[x] = mcnt++;
      e[mcnt] = (edge){x, pre[y]}, pre[y] = mcnt++;
    }
  }
  for (i = 1; i <= ncnt; ++i) {
    ans += val[i] * val[i];
  }
  memset(dfn, 0, sizeof(dfn));
  for (i = 1; i <= ncnt; ++i) {
    if (dfn[i]) continue;
    cnt = 0, V.clear();
    gfs(i);
    sum = 0;
    for (int j = 0; j < V.size(); ++j) {
      x = V[j];
      pfs(x, 0);
      vector<int> G;
      int S = 0;
      for (int k = pre[x]; ~k; k = e[k].next)
        G.push_back(s[e[k].x]), S += s[e[k].x];
      sum = max(gao(G) + g[x], sum);
    }
    ans += sum;
  }
  cout << ans << endl;
  return 0;
}
