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;
void reloc() {
  freopen("/Users/admin/Desktop/cards.in", "r", stdin);
  freopen("/Users/admin/Desktop/cards.out", "w", stdout);
  return;
}
const int maxn = 2000, inf = 1000000000;
int n, m, dfn[maxn + 1], low[maxn + 1],
    tt = 0, bcc[maxn + 1], nbcc = 0, siz[maxn + 1], d[maxn + 1][maxn + 1],
    d2[maxn + 1][maxn + 1], a[maxn + 1], d3[2][maxn + 1];
vector<int> g[maxn + 1], ng[maxn + 1];
stack<int> s;
bool ed[maxn + 1][maxn + 1], instack[maxn + 1];
void read() {
  int u, v;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  return;
}
void tarjan(int u, int pre) {
  tt++;
  low[u] = dfn[u] = tt;
  s.push(u);
  instack[u] = 1;
  for (auto v : g[u]) {
    if (v == pre) continue;
    if (dfn[v] == 0) {
      tarjan(v, u);
      low[u] = min(low[u], low[v]);
    } else
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    nbcc++;
    int t;
    do {
      t = s.top();
      s.pop();
      instack[t] = 0;
      bcc[t] = nbcc;
      siz[nbcc]++;
    } while (t != u);
  }
}
void prepare() {
  memset(dfn, 0, sizeof(dfn));
  memset(ed, 0, sizeof(ed));
  memset(instack, 0, sizeof(instack));
  tarjan(1, 1);
  for (int i = 1; i <= n; i++) {
    for (auto j : g[i]) {
      int u = bcc[i], v = bcc[j];
      if (u != v && ed[u][v] == 0) {
        ed[u][v] = ed[v][u] = 1;
        ng[u].push_back(v);
        ng[v].push_back(u);
      }
    }
  }
  return;
}
int dp(int u, int v) {
  if (d[u][v]) return d[u][v];
  d[u][v] = siz[v];
  for (auto i : ng[v]) {
    if (i == u) continue;
    d[u][v] += dp(v, i);
  }
  return d[u][v];
}
int dp2(int u, int v) {
  if (d2[u][v]) return d2[u][v];
  int ans = 0;
  for (auto i : ng[v]) {
    if (i == u) continue;
    d2[u][v] += dp2(v, i);
    ans += d[v][i];
  }
  d2[u][v] += ans * siz[v];
  d2[u][v] += siz[v] * (siz[v] - 1);
  return d2[u][v];
}
void Dp() {
  memset(d, 0, sizeof(d));
  memset(d2, 0, sizeof(d2));
  for (int i = 1; i <= nbcc; i++) {
    for (auto j : ng[i]) {
      dp(i, j);
    }
  }
  for (int i = 1; i <= nbcc; i++) {
    for (auto j : ng[i]) {
      dp2(i, j);
    }
  }
}
int Ans(int root) {
  int ans = siz[root] * (siz[root] - 1), maxi = 0, u = 0, le = 0, ri = 0;
  for (auto i : ng[root]) ans += d2[root][i] + siz[root] * d[root][i];
  tt = 0;
  for (auto i : ng[root]) a[++tt] = d[root][i], maxi += d[root][i];
  ri = maxi;
  maxi /= 2;
  for (int i = 0; i <= maxi; i++) d3[1][i] = d3[0][i] = -inf;
  d3[1][0] = d3[0][0] = 0;
  for (int i = 1; i <= tt; i++) {
    for (int j = 1; j <= maxi; j++) {
      d3[u][j] = d3[!u][j];
      if (j - a[i] >= 0) d3[u][j] = max(d3[!u][j], d3[!u][j - a[i]] + 1);
      if (d3[u][j] > 0) le = max(le, j);
    }
    u = !u;
  }
  ri -= le;
  return ans + le * ri;
}
void debug() {
  printf("sdg %d\n", d2[1][9]);
  for (int i = 1; i <= nbcc; i++) {
    printf("%d %d ", i, siz[i]);
    for (int j : ng[i]) printf("%d ", j);
    printf("\n");
  }
  return;
}
void work() {
  prepare();
  Dp();
  int ans = 0;
  for (int i = 1; i <= nbcc; i++) {
    ans = max(ans, Ans(i));
  }
  printf("%d\n", ans + n);
  return;
  return;
}
int main() {
  read();
  work();
  return 0;
}
