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

public class a
{
	public static void main(String[] arg) throws IOException
	{
		new a();
	}
	
	public a() throws IOException
	{
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int m = in.nextInt();
		DJS dj = new DJS(n);
		int[] u = new int[m];
		int[] v = new int[m];
		int[] eCount = new int[n];
		HashMap<Long, Integer> hm = new HashMap<Long, Integer>();
		for(int i = 0; i < m; i++)
		{
			u[i] = in.nextInt()-1;
			v[i] = in.nextInt()-1;
			dj.union(u[i], v[i]);
			eCount[v[i]]++;
			if(u[i] != v[i]) eCount[u[i]]++;

			int v1 = Math.min(u[i], v[i]);
			int v2 = Math.max(u[i], v[i]);
			long key = (((long)v1<<25)|v2);
			if(!hm.containsKey(key)) hm.put(key, 0);
			hm.put(key, hm.get(key)+1);
		}
		int sets = 0;
		for(int i = 0; i < n; i++)
		{
			if(dj.vs[i] < 0) sets++;
		}
		if(sets > 1)
		{
			out.println(0);
		}
		else
		{
			long ans = 0;
			for(int i = 0; i < m; i++)
			{
				int v1 = v[i];
				int v2 = u[i];
				eCount[v1]--;
				if(v1 != v2) eCount[v2]--;

				long shared = 0;
				int min = Math.min(v1, v2);
				int max = Math.max(v1, v2);
				long key = (((long)min<<25)|max);
				hm.put(key, hm.get(key)-1);
				shared += hm.get(key);
				ans += (eCount[v1]+eCount[v2]-shared);

			}
			out.println(ans);
		}
		in.close(); out.close();
	}
	class DJS
	{
		int[] vs;
		public DJS(int s)
		{
			vs = new int[s];
			Arrays.fill(vs,-1);
		}
		public int find(int a)
		{
			return vs[a] < 0 ? a : (vs[a]=find(vs[a]));
		}
		public boolean union(int a, int b)
		{
			int pa = find(a);
			int pb = find(b);
			if(pa == pb) return false;
			if(vs[pa] > vs[pb]) pa = pa^pb^(pb=pa);
			vs[pa] += vs[pb];
			vs[pb] = pa;
			return true;
		}
	}
	class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(InputStream in)
		{
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}
		public String next() throws IOException
		{
			while(!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}
		public void close() throws IOException
		{
			br.close();
		}
	}
}