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 inf = 1e9, mod = 1e9 + 7;
const int N = 2e3 + 5;
int com, i, j, k, n, m, x, y, start[N], back[N], splay_tree_which_i_invented,
    size[N], belong[N], sum[N], h[N], bridge[N][N];
bool edges[N][N];
long long c;
vector<int> g[N], v[N];
int dfs(int node, int root) {
  start[node] = ++splay_tree_which_i_invented;
  h[node] = 1;
  back[node] = splay_tree_which_i_invented;
  for (__typeof(v[node].begin()) it = v[node].begin(); it != v[node].end();
       it++) {
    if (edges[node][*it] || *it == root) continue;
    edges[*it][node] = 1;
    if (h[*it])
      back[node] = min(back[node], back[*it]);
    else
      back[node] = min(back[node], dfs(*it, node));
  }
  if (root && back[node] == start[node])
    bridge[node][root] = bridge[root][node] = true;
  return back[node];
}
void dfs2(int node) {
  belong[node] = com;
  h[node] = 2;
  for (__typeof(v[node].begin()) it = v[node].begin(); it != v[node].end();
       it++)
    if (bridge[node][*it] == false && 2 != h[*it]) {
      size[com]++;
      dfs2(*it);
    }
}
int pre_calculate(int node, int last, int d) {
  sum[node] = size[node];
  c += d * size[node];
  for (__typeof(g[node].begin()) it = g[node].begin(); it != g[node].end();
       it++)
    if (*it != last) sum[node] += pre_calculate(*it, node, d + size[node]);
  return sum[node];
}
long long solve(int x) {
  c = 0;
  pre_calculate(x, 0, 0);
  bitset<2001> dp;
  dp[0] = true;
  for (__typeof(g[x].begin()) it = g[x].begin(); it != g[x].end(); it++)
    dp |= dp << sum[*it];
  long long ans = 0;
  for (int i = 0; i <= n; i++)
    if (dp[i] == true) {
      ans = max(ans, (n - i - size[x]) * (long long)i + c);
    }
  return ans;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 0);
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    if (h[i] != 2) {
      size[++com]++;
      dfs2(i);
      ans += (long long)size[com] * (size[com]);
    }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (bridge[i][j]) {
        g[belong[i]].push_back(belong[j]);
        g[belong[j]].push_back(belong[i]);
      }
  long long cur = 0;
  for (int i = 1; i <= com; i++) cur = max(cur, solve(i));
  cout << ans + cur << '\n';
  return 0;
}
