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 long long int MOD = 1000000007;
const long long BIG = 1446803456761533460LL;
const int Big = 336860180;
const long long int INF = LONG_LONG_MAX;
const vector<vector<long long int> > adj4({{0, 1}, {0, -1}, {1, 0}, {-1, 0}});
const vector<vector<long long int> > adj8(
    {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}});
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
bool isprime(long long int n) {
  if (n == 2 || n == 3) return true;
  if (n < 2 || n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 6; (i - 1) * (i - 1) <= n; i += 6) {
    if (n % (i - 1) == 0 || n % (i + 1) == 0) {
      return false;
    }
  }
  return true;
}
vector<bool> sprime;
void genPrime(long long int sz) {
  sprime = vector<bool>(sz, true);
  sprime[0] = false;
  sprime[1] = false;
  for (long long int i = (2); i < (sz); ++i) {
    if (sprime[i]) {
      for (long long int j = i * i; j < sz; j += i) {
        sprime[j] = false;
      }
    }
  }
}
long long int powMod(long long int a, long long int b, long long int mod) {
  long long int n = 1;
  long long int p = a;
  while (b > 0) {
    if (b % 2 == 1) {
      n *= p;
      n %= mod;
    }
    p *= p;
    p %= mod;
    b /= 2;
  }
  return n;
}
long long int modularInverse(long long int a, long long int mod) {
  return powMod(a, mod - 2, mod);
}
long long int binarysearch(long long int l, long long int r,
                           bool (*bsfunction)(long long int)) {
  while (r - l > 1) {
    long long int mid = (l + r) / 2;
    bool val = bsfunction(mid);
    if (val) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return l;
}
stringstream sss;
const long long int maxn = 2010;
vector<pair<long long int, long long int> > g[maxn];
set<long long int> gg[maxn];
long long int vt[maxn];
long long int vt2[maxn];
long long int bridge[maxn * maxn];
long long int sz[maxn];
long long int sum[maxn];
long long int subt[maxn];
void dfs(long long int step, long long int par) {
  for (auto edge : g[step]) {
    long long int x = edge.first;
    long long int idx = edge.second;
    if (idx == par) continue;
    if (vt[x] == 0) {
      vt[x] = vt[step] + 1;
      dfs(x, idx);
      vt2[step] = min(vt2[step], (vt2[x]));
      if (vt2[x] <= vt[step]) {
        bridge[idx] = 1;
      }
    } else {
      bridge[idx] = 1;
      vt2[step] = min(vt2[step], (min(vt[x], vt2[x])));
    }
  }
}
void dfsz(long long int step, long long int par) {
  subt[step] = sz[step];
  for (auto x : gg[step]) {
    if (x != par) {
      dfsz(x, step);
      subt[step] += subt[x];
    }
  }
}
void MAIN() {
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 0; i < (m); ++i) {
    long long int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }
  vt[0] = 1;
  memset(vt2, 20, sizeof vt2);
  dfs(0, -1);
  long long int nn = 0;
  memset(vt, -1, sizeof vt);
  long long int r = 0;
  for (long long int i = 0; i < (n); ++i) {
    if (vt[i] != -1) continue;
    stack<long long int> stk;
    stk.push(i);
    vt[i] = nn;
    long long int s = 0;
    while (!stk.empty()) {
      long long int x = stk.top();
      stk.pop();
      ++s;
      for (auto y : g[x]) {
        if (bridge[y.second] && vt[y.first] == -1) {
          stk.push(y.first);
          vt[y.first] = nn;
        }
      }
    }
    sz[nn] = s;
    r += s * s;
    ++nn;
  }
  for (long long int i = 0; i < (n); ++i) {
    for (auto x : g[i]) {
      gg[vt[i]].insert(vt[x.first]);
    }
    gg[vt[i]].erase(vt[i]);
  }
  long long int rr = 0;
  for (long long int ver = 0; ver < (nn); ++ver) {
    memset(sum, 0, sizeof sum);
    sum[0] = 1;
    dfsz(ver, -1);
    for (auto x : gg[ver]) {
      long long int v = subt[x];
      for (long long int i = (n - v) - 1; i >= 0; --i) {
        sum[i + v] |= sum[i];
      }
    }
    long long int subpath = 0;
    for (long long int i = 0; i < (nn); ++i) {
      subpath += subt[i] * sz[i];
    }
    for (long long int i = 0; i < (n); ++i) {
      if (sum[i]) {
        long long int val = i * (n - i - sz[ver]);
        rr = max(rr, (val + subpath));
      }
    }
  }
  cout << (rr) << endl;
}
const long long int TESTCASEN = 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  sss << R"(
5 4
1 2
1 3
1 4
1 5
8 10
1 2
2 3
3 1
4 5
5 6
6 4
6 7
7 8
8 3
1 8
6 7
1 2
2 3
1 3
1 4
4 5
5 6
6 4
5 4
1 2
1 3
1 4
1 5
6 7
1 2
2 3
1 3
1 4
4 5
5 6
6 4
6 7
1 2
2 3
1 3
1 4
4 5
5 6
6 4
    )";
  for (long long int i = 0; i < (TESTCASEN); ++i) {
    MAIN();
  }
  return 0;
}
