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 = 2e3 + 3;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
struct edge {
  int u, v;
  bool drt;
  edge(int _u = 0, int _v = 0, bool _drt = 0) : u(_u), v(_v), drt(_drt) {}
} ed[N * N];
int n, m, id[N], low[N], num[N], vtime, nNode[N], component, child[N], dp[N],
    ans;
vector<int> g[N], tree[N];
stack<int> st;
void dfs(int u, int p) {
  low[u] = num[u] = ++vtime;
  st.push(u);
  for (int i : g[u]) {
    int v = ed[i].u + ed[i].v - u;
    if (ed[i].drt && ed[i].drt != v) continue;
    if (v == p) continue;
    ed[i].drt = v;
    if (!num[v]) {
      dfs(v, u);
      low[u] = min(low[u], low[v]);
    } else
      low[u] = min(low[u], num[v]);
  }
  if (low[u] == num[u]) {
    ++component;
    while (true) {
      id[st.top()] = component;
      nNode[component]++;
      if (st.top() == u) {
        st.pop();
        break;
      }
      st.pop();
    }
  }
}
void dfs2(int u, int p) {
  child[u] = nNode[u];
  dp[u] = 0;
  for (int v : tree[u]) {
    if (v == p) continue;
    dfs2(v, u);
    child[u] += child[v];
    dp[u] += dp[v];
  }
  dp[u] += child[u] * nNode[u];
}
vector<bool> Knapsack(vector<int> a) {
  vector<bool> ans(n + 1, 0);
  ans[0] = 1;
  for (int i = 0; i < a.size(); i++) {
    for (int j = n; j >= 0; j--) {
      if (j < a[i]) continue;
      ans[j] = ans[j] | ans[j - a[i]];
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(i);
    g[v].push_back(i);
    ed[i] = edge(u, v, 0);
  }
  dfs(1, 0);
  for (int i = 1; i <= m; i++) {
    int u = ed[i].u, v = ed[i].v;
    if (id[u] == id[v]) continue;
    tree[id[u]].push_back(id[v]);
    tree[id[v]].push_back(id[u]);
  }
  for (int i = 1; i <= component; i++) {
    dfs2(i, 0);
    int op = dp[i], add = 0;
    vector<int> a;
    for (int v : tree[i]) a.push_back(child[v]);
    vector<bool> ok = Knapsack(a);
    for (int j = 0; j <= n; j++)
      if (ok[j]) add = max(add, j * (n - nNode[i] - j));
    op += add;
    ans = max(ans, op);
  }
  cout << ans << endl;
  return 0;
}
