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 solve();
void prec();
int main() {
  string s = "souvenir";
  cout.sync_with_stdio(0);
  cout.precision(20);
  cout << fixed;
  int tests = 1;
  while (tests--) {
    solve();
  }
  return 0;
}
const int MAXN = 2202;
int n;
vector<int> g[MAXN];
bool used[MAXN];
char matrix[MAXN][MAXN];
int timer, tin[MAXN], fup[MAXN];
vector<pair<int, int> > bridges;
void dfs(int v, int p = -1) {
  used[v] = true;
  tin[v] = fup[v] = timer++;
  for (size_t to = 0; to < n; ++to) {
    if (matrix[v][to] == 0) {
      continue;
    }
    if (to == p) continue;
    if (used[to])
      fup[v] = min(fup[v], tin[to]);
    else {
      dfs(to, v);
      fup[v] = min(fup[v], fup[to]);
      if (fup[to] > tin[v]) {
        bridges.push_back(pair<int, int>(v, to));
        matrix[v][to] = 0;
        matrix[to][v] = 0;
      }
    }
  }
}
void find_bridges() {
  timer = 0;
  for (int i = 0; i < n; ++i) used[i] = false;
  for (int i = 0; i < n; ++i)
    if (!used[i]) dfs(i);
}
int dsu[MAXN];
int size[MAXN];
int get(int a) {
  if (dsu[a] == a)
    return a;
  else
    return dsu[a] = get(dsu[a]);
}
void unite(int a, int b) {
  a = get(a);
  b = get(b);
  if (a == b) return;
  dsu[a] = b;
  size[b] += size[a];
  size[a] = 0;
}
int xxx[MAXN];
int go(int v, int p) {
  int res = size[v];
  for (int to : g[v])
    if (to != p) res += go(to, v);
  xxx[v] = res;
  return res;
}
int go2(int v, int p) {
  int res = size[v] * size[v];
  for (int to : g[v])
    if (to != p) {
      res += go2(to, v);
      res += xxx[to] * size[v];
    }
  return res;
}
void solve() {
  int m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    matrix[a][b] = matrix[b][a] = 1;
  }
  find_bridges();
  for (int i = 0; i < n; ++i) {
    dsu[i] = i;
    size[i] = 1;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j)
      if (matrix[i][j]) {
        unite(i, j);
      }
  }
  for (auto x : bridges) {
    int a = get(x.first);
    int b = get(x.second);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int res = 0;
  for (int root = 0; root < n; ++root) {
    if (size[root] == 0) continue;
    int ans = 0;
    ans += size[root] * n;
    vector<int> sizes;
    for (int to : g[root]) {
      int z = go(to, root);
      sizes.push_back(z);
      int t = go2(to, root);
      ans += t;
    }
    vector<int> pos(n + 1);
    pos[0] = true;
    for (int size : sizes) {
      for (int i = n - 1; i >= 0; --i) {
        if (!pos[i]) continue;
        if (i + size <= n) {
          pos[i + size] = true;
        }
      }
    }
    int mx = 0;
    for (int k = 0; k <= n; ++k) {
      if (pos[k]) {
        mx = max(mx, k * (n - size[root] - k));
      }
    }
    res = max(ans + mx, res);
  }
  cout << res;
}
