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;
int DFSindex = 0;
int num[2001];
int low[2001];
int p[2001];
bool brid[2001][2001];
bool instack[2001];
vector<int> adjv[2001];
set<int> adj[2001];
void tarjan(int v) {
  num[v] = low[v] = DFSindex++;
  instack[v] = true;
  for (int i = 0; i < adjv[v].size(); i++) {
    int n = adjv[v][i];
    if (num[n] == -1) {
      p[n] = v;
      tarjan(n);
      low[v] = min(low[v], low[n]);
      if (low[n] > num[v]) brid[n][v] = brid[v][n] = true;
    } else if (instack[n] && p[v] != n)
      low[v] = min(low[v], num[n]);
  }
  instack[v] = false;
}
int comp[2001];
bool counted[2001];
int count(int u, int compnum) {
  counted[u] = true;
  comp[u] = compnum;
  int ret = 1;
  for (int i = 0; i < adjv[u].size(); i++) {
    int v = adjv[u][i];
    if (!counted[v] && !brid[u][v]) {
      ret += count(v, compnum);
    }
  }
  return ret;
}
set<int> compadj[2001];
vector<int> sizes;
int subtrees = 0;
int rootc[2001];
int rootcount(int u, int p) {
  rootc[u] = 0;
  for (set<int>::iterator it = compadj[u].begin(); it != compadj[u].end();
       it++) {
    int v = *it;
    if (v != p) {
      rootc[u] += rootcount(v, u);
    }
  }
  subtrees += sizes[u] * rootc[u];
  rootc[u] += sizes[u];
  return rootc[u];
}
int main() {
  int V, E;
  cin >> V >> E;
  memset(num, -1, sizeof(num));
  memset(p, -1, sizeof(num));
  memset(brid, false, sizeof(bool) * 2001 * 2001);
  memset(instack, false, sizeof(instack));
  for (int i = 0; i < V; i++) {
    adj[i] = set<int>();
    adjv[i] = vector<int>();
  }
  for (int i = 0; i < E; i++) {
    int src, dest;
    cin >> src >> dest;
    src--;
    dest--;
    adj[src].insert(dest);
    adj[dest].insert(src);
    adjv[src].push_back(dest);
    adjv[dest].push_back(src);
  }
  for (int i = 0; i < V; i++) {
    if (num[i] == -1) tarjan(i);
  }
  int ans = 0;
  memset(counted, false, sizeof(counted));
  memset(comp, -1, sizeof(comp));
  int c = 0;
  for (int i = 0; i < V; i++) {
    if (!counted[i]) {
      int curr_count = count(i, c++);
      sizes.push_back(curr_count);
      ans += curr_count * curr_count;
    }
  }
  for (int i = 0; i < c; i++) {
    compadj[i] = set<int>();
  }
  for (int i = 0; i < V; i++) {
    for (int j = i + 1; j < V; j++) {
      if (comp[i] != comp[j] && adj[i].find(j) != adj[i].end()) {
        compadj[comp[i]].insert(comp[j]);
        compadj[comp[j]].insert(comp[i]);
      }
    }
  }
  int maxorient = 0;
  bool possibrootconf[2001];
  for (int root = 0; root < c; root++) {
    memset(rootc, -1, sizeof(rootc));
    subtrees = 0;
    int rootweights = 0;
    vector<int> rootchildweights;
    for (set<int>::iterator it = compadj[root].begin();
         it != compadj[root].end(); it++) {
      int u = *it;
      int currchildweight = rootcount(u, root);
      rootweights += currchildweight;
      rootchildweights.push_back(currchildweight);
    }
    int maxroot = 0;
    memset(possibrootconf, false, sizeof(possibrootconf));
    possibrootconf[0] = true;
    for (int i = 0; i < rootchildweights.size(); i++) {
      int weight = rootchildweights[i];
      for (int j = 2001; j >= weight; j--) {
        if ((j - weight) >= 0 && possibrootconf[j - weight]) {
          possibrootconf[j] = true;
        }
      }
    }
    for (int i = 0; i <= 2001; i++) {
      if (possibrootconf[i]) {
        int curr = (i + sizes[root]) * (rootweights - i) + i * sizes[root];
        if (curr > maxroot) {
          maxroot = curr;
        }
      }
    }
    maxorient = max(maxorient, subtrees + maxroot);
  }
  cout << ans + maxorient << endl;
  return 0;
}
