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;
template <class T>
string ToString(T t) {
  stringstream s;
  s << t;
  return s.str();
}
template <class T>
void ToOther(T &t, string a) {
  stringstream s(a);
  s >> t;
}
int n, m;
vector<int> v[2222];
vector<int> vv[2222];
int dfn[2222];
int low[2222];
int num = 0;
int G;
int vis[2222];
int cnt[2222];
bool bc[2222][2222];
int numCh[2222];
void bcc(int x, int p) {
  dfn[x] = low[x] = ++num;
  for (int i = 0; i < v[x].size(); i++) {
    int t = v[x][i];
    if (t == p) continue;
    if (dfn[t] == 0) {
      bcc(t, x);
      low[x] = min(low[x], low[t]);
      if (low[t] > dfn[x]) {
        bc[t][x] = bc[x][t] = 1;
      }
    } else {
      low[x] = min(low[x], dfn[t]);
    }
  }
}
void go(int x) {
  vis[x] = G;
  cnt[G]++;
  for (int i = 0; i < v[x].size(); i++) {
    int t = v[x][i];
    if (bc[x][t]) {
      if (vis[t] != -1) {
        vv[G].push_back(vis[t]);
        vv[vis[t]].push_back(G);
      }
      continue;
    }
    if (vis[t] == -1) go(t);
  }
}
pair<int, int> dfs(int x, int p, int sum) {
  pair<int, int> r(cnt[x] * cnt[x] + sum * cnt[x], cnt[x]);
  for (int i = 0; i < vv[x].size(); i++) {
    int t = vv[x][i];
    if (t == p) continue;
    pair<int, int> temp = dfs(t, x, sum + cnt[x]);
    r.first += temp.first;
    r.second += temp.second;
  }
  return r;
}
int dfs2(int x, int p) {
  int &r = numCh[x];
  r += cnt[x];
  for (int i = 0; i < vv[x].size(); i++) {
    int t = vv[x][i];
    if (t == p) continue;
    r += dfs2(t, x);
  }
  return r;
}
bool d[2005] = {0};
bool d2[2005] = {0};
int calc(int x) {
  memset(d, 0, sizeof(d));
  memset(d2, 0, sizeof(d2));
  int r = cnt[x] * cnt[x];
  vector<int> v;
  for (int i = 0; i < vv[x].size(); i++) {
    int t = vv[x][i];
    pair<int, int> temp = dfs(t, x, 0);
    r += temp.first;
    v.push_back(temp.second);
  }
  if (v.size()) {
    d[v[0]] = 1;
    for (int i = 1; i < v.size(); i++) {
      memset(d2, 0, sizeof(d2));
      for (int k = 2000; k >= 0; k--)
        if (d[k]) {
          d2[k + v[i]] = d2[((k - v[i]) < 0 ? (-(k - v[i])) : (k - v[i]))] = 1;
        }
      memcpy(d, d2, sizeof(d2));
    }
    int t = 0;
    for (int i = 0; i <= 2000; i++)
      if (d[i]) {
        int a = (n + i - cnt[x]) / 2;
        int b = a - i;
        t = max(t, a * (b + cnt[x]) + cnt[x] * b);
        t = max(t, (a + cnt[x]) * b + cnt[x] * a);
      }
    r += t;
  }
  return r;
}
int mid = 0;
void Find(int x, int p) {
  int M = -1;
  int idx = -1;
  for (int i = 0; i < vv[x].size(); i++) {
    int t = vv[x][i];
    if (t == p) continue;
    if (M < cnt[x] + numCh[t]) {
      M = cnt[x] + numCh[t];
      idx = t;
    }
  }
  if (M > n / 2) {
    mid = idx;
    Find(idx, x);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int s, e;
    scanf("%d%d", &s, &e);
    s--;
    e--;
    v[s].push_back(e);
    v[e].push_back(s);
  }
  bcc(0, -1);
  memset(vis, -1, sizeof(vis));
  for (int i = 0; i < n; i++)
    if (vis[i] == -1) {
      go(i);
      G++;
    }
  int r = 0;
  dfs2(0, -1);
  Find(0, -1);
  for (int i = 0; i < G; i++) r = max(r, calc(i));
  r = max(r, calc(mid));
  cout << r << endl;
}
