100 10
87 73
15 71
14 33
1 4
20 80
65 67
36 36
25 4
22 21
7 97
 4 2
3 3
3 4
 5 4
3 3
4 4
5 5
1 2
 4 4
1 2
2 3
3 1
4 4
 4 3
1 1
2 3
3 4
 1000000 1
255765 255765
 4 3
1 2
2 3
4 4
 4 2
1 1
1 2
 3 3
1 1
2 2
3 3
 5 4
1 1
2 3
2 4
2 5
 4 5
1 4
3 4
1 2
2 3
2 4
 4 4
2 3
2 4
3 4
4 4
 10 9
8 10
3 10
2 8
9 3
4 8
1 10
7 9
5 4
7 3
 10 10
1 2
2 3
3 4
4 5
5 1
6 6
7 7
8 8
9 9
10 10
 5 5
1 4
3 4
1 2
2 3
2 4
 3 3
1 2
2 2
3 3
 5 3
1 1
2 2
3 3
 6 12
1 2
1 3
2 3
1 1
2 2
3 3
4 5
5 6
4 6
4 4
5 5
6 6
 4 4
1 2
2 3
1 3
4 4
 5 4
1 2
3 3
4 4
5 5
 7 13
6 7
2 7
3 7
4 3
5 2
1 4
7 7
3 1
5 5
3 3
1 5
2 6
6 6
 2 2
1 1
2 2
 5 5
1 1
2 2
3 3
4 4
5 5
 1 1
1 1
 7 3
1 1
3 3
6 6
 3 3
1 1
2 3
3 3

0 1 0 0 0 0 0 1 0 0 8 6 12 0 8 0 0 0 0 0 57 0 0 0 0 0
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B407 {
	static int V, E;
	public static void main(String[] args) {
		FS scan = new FS(System.in);
		
		V = scan.nextInt();
		E= scan.nextInt();
		long self = 0;
		adj = new ArrayList[V];
		ArrayList<Edge> edges = new ArrayList<>();
		for(int i=0;i<V;i++)adj[i] = new ArrayList<>();
		for(int i=0;i<E;i++){
			Edge e = new Edge(scan.nextInt()-1,scan.nextInt()-1);
			e.id = i;
			edges.add(e);
			adj[e.u].add(e);
			if(e.u!=e.v)
				adj[e.v].add(e);
			else{
				self++;
			}
		}
		
		dfsLowLink();
		boolean valid = true;
		long count = 0;
		for(int i=0;i<V;i++){
			long nb = 0, b = 0;
			for(Edge e : adj[i]){
				if(!e.seen)valid=false;
				if(!e.bridge)nb++;
				else b++;
			}
			count+=nb*(nb-1)/2 + nb*b + b*(b-1)/2;
		}
		count+=self*(self-1)/2;
		System.out.println(valid?count:0);
	}
	
	static ArrayList<Edge>[] adj;
	static int[] index, lowlink;
	static int c = 0;
	private static void dfsLowLink(){
		index = new int[V]; lowlink = new int[V];
		Arrays.fill(index, -1);
		boolean[] seen = new boolean[V];
		seen[0] = true;
		ArrayDeque<Edge> stack = new ArrayDeque<>();
		dfs(0, -1, stack, seen);
		
	}
	private static int dfs(int idx, int par, ArrayDeque<Edge> stack, boolean[] seen) {
		if(index[idx]==-1){
			index[idx] = lowlink[idx] = c++;
		}
		for(Edge e : adj[idx]){
			int v = e.getOp(idx);
			if(e.seen)continue;
			if(v==par)continue;
			stack.push(e);
			e.seen = true;
			if(seen[v]){
				lowlink[idx] = Math.min(lowlink[idx],index[v]);
				continue;
			}
			seen[v] = true;
			int k;
			lowlink[idx] = Math.min(lowlink[idx],k= dfs(v, idx, stack, seen));
			if(index[idx] <= k){
				ArrayList<Edge> list = new ArrayList<>();
				while(true){
					int a = stack.peek().u, b = stack.peek().v;
					list.add(stack.pop());
					if((a==idx&&b==v)||(a==v&&b==idx))break;
				}
				if(list.size()==1){
					int h = list.get(0).u, g = list.get(0).v;
					if(adj[h].size()==1||adj[g].size()==1)continue;
					list.get(0).bridge=true;
				}
				//print 'list' for biconnected component
			}
		}
		return lowlink[idx];
	}
	private static class Edge {
		int u, v, id;
		boolean bridge, seen;
		public Edge(int u, int v){this.u=u;this.v=v;}
		public int getOp(int a){return a==u?v:u;}
		public String toString() {return u+" "+v;}
	}
	public static class FS {
		BufferedReader br;
		StringTokenizer st;
	
		public String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
				}
			}
			return st.nextToken();
		}
	
		public FS(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
	
		int nextInt() {
			return Integer.parseInt(next());
		}
	
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}
