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 maxn = 4003;
int head[maxn], tol;
struct Edge {
  int next, to;
} edge[4004000];
void addedge(int u, int v) {
  edge[tol].to = v;
  edge[tol].next = head[u];
  head[u] = tol++;
}
int low[maxn], dfn[maxn], Stack[maxn], instack[maxn], top, indexx, scc;
int weight[maxn], size[maxn], belong[maxn];
bool dp[maxn];
vector<int> pp[maxn];
void tarjan(int u, int pre) {
  int v;
  low[u] = dfn[u] = ++indexx;
  instack[u] = 1;
  Stack[top++] = u;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    v = edge[i].to;
    if (v == pre) continue;
    if (!dfn[v]) {
      tarjan(v, u);
      if (low[u] > low[v]) low[u] = low[v];
    } else if (instack[v] && low[u] > dfn[v])
      low[u] = dfn[v];
  }
  if (low[u] == dfn[u]) {
    scc++;
    do {
      v = Stack[--top];
      instack[v] = 0;
      weight[scc]++;
      belong[v] = scc;
    } while (u != v);
  }
}
int dfs(int u, int fa) {
  size[u] = 0;
  int ans = 0;
  int sz = pp[u].size();
  for (int i = 0; i < sz; i++) {
    int v = pp[u][i];
    if (v == fa) continue;
    ans += dfs(v, u);
    size[u] += size[v];
  }
  ans += weight[u] * size[u];
  size[u] += weight[u];
  return ans;
}
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    memset(head, -1, sizeof(head));
    tol = 0;
    while (m--) {
      int x, y;
      scanf("%d%d", &x, &y);
      addedge(x, y);
      addedge(y, x);
    }
    memset(dfn, 0, sizeof(dfn));
    memset(instack, 0, sizeof(instack));
    memset(weight, 0, sizeof(weight));
    top = indexx = scc = 0;
    for (int i = 1; i <= n; i++)
      if (!dfn[i]) tarjan(i, i);
    for (int i = 1; i <= scc; i++) pp[i].clear();
    int ans = 0;
    for (int i = 1; i <= scc; i++) ans += weight[i] * weight[i];
    for (int i = 1; i <= n; i++)
      for (int j = head[i]; j != -1; j = edge[j].next) {
        int k = edge[j].to;
        if (belong[i] == belong[k]) continue;
        pp[belong[i]].push_back(belong[k]);
      }
    int tot = 0;
    for (int i = 1; i <= scc; i++) {
      memset(dp, 0, sizeof(int) * n);
      dp[0] = 1;
      int cnt = 0;
      int sz = pp[i].size();
      for (int j = 0; j < sz; j++) {
        int k = pp[i][j];
        cnt += dfs(k, i);
        cnt += weight[i] * size[k];
        for (int h = n - weight[i] - size[k]; h >= 0; h--)
          dp[h + size[k]] |= dp[h];
      }
      for (int j = 0; j <= n - weight[i]; j++)
        if (dp[j]) tot = max(tot, cnt + j * (n - weight[i] - j));
    }
    ans += tot;
    cout << ans << endl;
  }
  return 0;
}
