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)}
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		new Task().solve(1,in,out);
		out.close();
	}
}

class Task {
	void solve(int ca,Scanner in,PrintWriter out) {
		n = in.nextInt();
		m = in.nextInt();
		edges = new List[n];
		for (int i = 0; i < n; ++ i) {
			edges[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < m; ++ i) {
			int a = in.nextInt()-1;
			int b = in.nextInt()-1;
			edges[a].add(new Integer(b));
			edges[b].add(new Integer(a));
		}
		scc();
		nedges = new List[btot];
		weight = new int[btot];
		for (int i = 0; i < btot; ++ i) {
			nedges[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < n; ++ i) {
			int u = belong[i];
			weight[u] ++;
			for (Integer j : edges[i]) {
				int v = belong[j];
				if (u == v) continue;
				nedges[u].add(new Integer(v));
			}
		}
		int answer = 0;
		for (int i = 0; i < btot; ++ i) {
			answer += weight[i] * (weight[i]-1);
		}
		size = new int[btot];
		int vmax = 0;
		for (int i = 0; i < btot; ++ i) {
			boolean[] dp = new boolean[n+1];
			dp[0] = true;
			int count = 0;
			for (int j : nedges[i]) {
				count += dfs(j,i);
				count += size[j] * weight[i];
				for (int k = n-size[j]; k >= 0; -- k) {
					dp[k+size[j]] |= dp[k];
				}
			}
			for (int j = 0; j <= n-weight[i]; ++ j) {
				if (dp[j])
					vmax = Math.max(vmax,count+j*(n-weight[i]-j));
			}
		}
		answer += vmax;
		answer += n;
		out.println(answer);
	}

	int dfs(int u,int fa) {
		size[u] = 0;
		int ret = 0;
		for (Integer v : nedges[u]) {
			if (v == fa) continue;
			ret += dfs(v,u);
			size[u] += size[v];
		}
		ret += weight[u] * size[u];
		size[u] += weight[u];
		return ret;
	}

	void scc() {
		dfn = new int[n];
		low = new int[n];
		belong = new int[n];
		stack = new int[n];
		for (int i = 0; i < n; ++ i) {
			if (dfn[i] == 0) tarjan(i,-1);
		}
	}

	void tarjan(int u,int fa) {
		dfn[u] = low[u] = ++ tim;
		stack[top++] = u;
		for (Integer v : edges[u]) {
			if (v == fa) continue;
			if (dfn[v] == 0) {
				tarjan(v,u);
			}
			low[u] = Math.min(low[u],low[v]);
		}
		if (low[u] == dfn[u]) {
			while (true) {
				int v = stack[--top];
				belong[v] = btot;
				if (v == u) break;
			}
			btot ++;
		}
	}
	int n,m;
	List<Integer>[] edges;
	int[] dfn;
	int[] low;
	int[] belong;
	int[] stack;
	int btot,tim,top;

	List<Integer>[] nedges;
	int[] weight;
	int[] size;
}
