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 show() {}
template <typename T, typename... V>
void show(T t, V... v) {
  cerr << t;
  if (sizeof...(v)) cerr << ", ";
  show(v...);
}
template <class X>
bool mini(X& a, const X& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class X>
bool maxi(X& a, const X& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
typedef const int& ci;
const int N = 2001;
int n, m;
int low[N], num[N];
bool bridge[N][N];
int gr[N];
int sz[N];
int w[N];
bool check;
vector<int> ke[N];
vector<int> g[N];
void enter() {
  cin >> n >> m;
  for (int i = 1, u, v; i <= m; ++i) {
    cin >> u >> v;
    ke[u].emplace_back(v);
    ke[v].emplace_back(u);
  }
}
void dfs(int u, int pa = 0) {
  low[u] = num[u] = ++num[0];
  for (int& v : ke[u])
    if (!low[v]) {
      dfs(v, u);
      mini(low[u], low[v]);
      if (low[v] >= num[v]) check = bridge[u][v] = bridge[v][u] = true;
    } else if (v != pa)
      mini(low[u], num[v]);
}
void collect(int u, int num) {
  ++sz[num];
  gr[u] = num;
  for (int& v : ke[u])
    if (!bridge[u][v]) {
      if (!gr[v]) collect(v, num);
    } else if (gr[v]) {
      g[num].emplace_back(gr[v]);
      g[gr[v]].emplace_back(num);
    }
}
void dp(int u, int& res, int pa = 0) {
  w[u] = sz[u];
  for (int& v : g[u])
    if (v != pa) dp(v, res, u), w[u] += w[v];
  if (pa) res += sz[u] * (w[u] - sz[u]);
}
int Test(int root) {
  int res = 0;
  dp(root, res);
  vector<bool> f(n + 1);
  f[0] = true;
  int S = 0;
  for (int& v : g[root]) {
    S += w[v];
    for (int j = S, _b = (w[v]) - 1; j > _b; --j)
      if (f[j - w[v]]) f[j] = true;
  }
  int add = 0;
  for (int in = 0, _b = (S) + 1; in < _b; ++in)
    if (f[in]) {
      int out = w[root] - sz[root] - in;
      if (maxi(add, (in + sz[root]) * out + in * sz[root]))
        ;
    }
  res += add;
  return res;
}
void solve() {
  dfs(1);
  if (!check)
    cout << n * n;
  else {
    for (int i = 1, _b = (n) + 1; i < _b; ++i)
      if (!gr[i]) collect(i, i);
    int res = 0;
    for (int i = 1, _b = (n) + 1; i < _b; ++i)
      if (gr[i] == i) maxi(res, Test(i));
    for (int i = 1, _b = (n) + 1; i < _b; ++i)
      if (gr[i] == i) res += sz[i] * sz[i];
    cout << res;
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  enter();
  solve();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms";
}
