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, p[N], sz[N], sub_sz[N], f[N], dp[N][N], nd[N];
pair<int, int> edge[N * N];
int low[N], num[N];
bool bridge[N * N];
vector<int> adj[N], g[N];
void dfs(int u, int p = 0) {
  static int Time = 0;
  low[u] = num[u] = ++Time;
  for (auto& i : adj[u]) {
    int v = edge[i].first + edge[i].second - u;
    if (v == p) continue;
    if (!num[v]) {
      dfs(v, u);
      low[u] = min(low[u], low[v]);
      if (low[v] > num[u]) bridge[i] = true;
    } else
      low[u] = min(low[u], num[v]);
  }
}
int Find(int x) {
  if (x == p[x]) return x;
  return p[x] = Find(p[x]);
}
void Union(int u, int v) {
  u = Find(u);
  v = Find(v);
  if (u == v) return;
  p[u] = v;
  sz[v] += sz[u];
}
void go(int u, int p = 0, int dep = 0) {
  sub_sz[u] = sz[u];
  f[u] = sz[u] * dep;
  for (auto& v : g[u]) {
    if (v == p) continue;
    go(v, u, dep + sz[u]);
    sub_sz[u] += sub_sz[v];
    f[u] += f[v];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> edge[i].first >> edge[i].second;
    adj[edge[i].first].push_back(i);
    adj[edge[i].second].push_back(i);
  }
  dfs(1);
  iota(p + 1, p + n + 1, 1);
  for (int i = 1; i <= n; i++) sz[i] = 1;
  for (int i = 1; i <= m; i++)
    if (!bridge[i]) Union(edge[i].first, edge[i].second);
  long long res = n;
  for (int i = 1; i <= n; i++) {
    if (i != Find(i)) continue;
    res += 1ll * sz[i] * (sz[i] - 1);
  }
  for (int i = 1; i <= m; i++) {
    if (!bridge[i]) continue;
    int u = Find(edge[i].first);
    int v = Find(edge[i].second);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int opt = 0;
  for (int i = 1; i <= n; i++) {
    if (i != Find(i)) continue;
    go(i);
    int m = 0;
    for (int j = 0; j <= n; j++) dp[i][j] = -1e9;
    dp[i][0] = 0;
    for (auto& v : g[i]) {
      for (int j = 0; j <= m + sub_sz[v]; j++) nd[j] = -1e9;
      for (int j = 0; j <= m; j++) {
        nd[j + sub_sz[v]] = max(nd[j + sub_sz[v]], dp[i][j] + f[v]);
        nd[j] = max(nd[j], dp[i][j] + f[v]);
      }
      m += sub_sz[v];
      for (int j = 0; j <= m; j++) dp[i][j] = nd[j];
    }
    for (int j = 0; j <= n; j++) {
      opt = max(opt, dp[i][j] + j * (n - sz[i] - j));
    }
  }
  cout << res + opt;
}
