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

public class main
{
	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	private static long mod = 1000000000 + 7;
	private static void soln()
	{
		/*long b1= nextLong();
		long q=nextLong();
		long l =nextLong();
		int m =nextInt();
		HashSet<Long> set = new HashSet<>();
		for(int i=0;i<m;i++)
			set.add(nextLong());
		//int[] arr = nextIntArray(m);
		long b=Math.abs(b1);
		if(q==1) {
			if(set.contains(b1) || b>l)
				pw.println(0);
			else
				pw.println("inf");
		}
		else if(q==-1) {
			if(b<=l) {
				if(!set.contains(b1) || !set.contains(-b1))
					pw.println("inf");
				else
					pw.println(0);
			}else
				pw.println(0);
		} else if(b1==0) {
			if(set.contains(0))
				pw.println(0);
			else
				pw.println("inf");
		}else if(q==0) {
			if(b<=l) {
				if(set.contains(0))
					if(set.contains(b1))
						pw.println(0);
					else
						pw.println(1);
				else
					pw.println("inf");
			}
			else
				pw.println("0");
		}
		else {
			int cnt=0;
			while(Math.abs(b1)<=l) {
				if(!set.contains(b1))
					cnt++;
				b1*=q;
			}
			pw.println(cnt);
		}*/
		int n = nextInt();
		int m = nextInt();
		LinkedList<Integer>[] l = new LinkedList[n];
		for(int i=0;i<n;i++)
			l[i]=new LinkedList<>();
		int[] cnt=new int[n];
		int[] ha = new int[n];
		DSU dsu =new DSU(n);
		for(int i=0;i<m;i++) {
			int u =nextInt()-1;
			int v = nextInt() - 1;
			if(u==v) {
				ha[u]++;
			}else {
				l[u].add(0,v);
				l[v].add(0,u);
				cnt[u]++;
				cnt[v]++;
			}
			dsu.Union(u, v);
		}
		boolean f = true;
		int pa = dsu.parent[0];
		for(int i=1;i<n;i++)
			if(dsu.parent[i]!=pa) {
				f=false;
				break;
			}
		if(m<2)
			f=false;
		long ans = 0;
		if(n==2) {
			if(m==3)
				ans = 2;
			if(m==2)
				ans=1;
		}
		else {
			long[] cntno = new long[n];
			long[] ha1 = new long[n];
			for(int i=0;i<n;i++) {
				if(cnt[i]==1) {
					//System.out.println(i+1);
					cntno[l[i].get(0)]++;
					ha1[l[i].get(0)]+=ha[i];
					if(cnt[l[i].get(0)]==2 && n!=3) {
						ans++;
					}
				}
				ans += (ha[i]*(ha[i]-1))/2;
			}
		//	System.out.println(ans);
			for(int i=0;i<n;i++) {
				ans += (cntno[i]*(cntno[i]-1))/2;
				ans += ha[i]*cntno[i];
				ans += ha1[i];
				//System.out.println((i+1)+" "+cntno[i]);
			}
			//System.out.println(ans);
		}
		if(f) {
			pw.println(ans);
		}
		else
			pw.println(0);
	}
	private static class DSU{
		int[] parent;
		int[] rank;
		int cnt;
		public DSU(int n){
			parent=new int[n];
			rank = new int[n];
			for(int i=0;i<n;i++){
				parent[i]=i;
			}
			cnt=n;
		}
		int find(int i){
	        while(parent[i] !=i){
	        	parent[i]=parent[parent[i]];
	        	i=parent[i];
	        }
	        return i;
	    }
		void Union(int x, int y){
			int x1 = find(x);
			int y1 =find(y);
			if(rank[x1]<rank[y1]) {
				parent[x1]=y1;
			}
			else if(rank[x1]>rank[y1]) {
				parent[y1]=x1;
			}
			else {
				parent[x1]=y1;
				rank[y1]++;
			}
	    }
	}

	public static class Segment {
		private int[] tree;
		private boolean[] lazy;
		private int size;
		private int n;
		private class node{
			private int a;
			private int b;
			private int c;
			public node(int x,int y,int z){
				a=x;
				b=y;
				c=z;
			}
		}
		public Segment(int n){
			//this.base=arr;
			int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
	        size = 2 * (int) Math.pow(2, x) - 1;
			tree=new int[size];
			lazy=new boolean[size];
			this.n=n;
			build(0,0,n-1);
		}
		public void build(int id,int l,int r) {
			if(l==r) {
				return;
			}
			int mid=(l+r)/2;
			build(2*id+1,l,mid);
			build(2*id+2,mid+1,r);
			tree[id]=tree[2*id+1]+tree[2*id+2];
		}
		public int query(int l,int r){
			return queryUtil(l,r,0,0,n-1);
		}
		private int queryUtil(int x,int y,int id,int l,int r){
			if(l>y || x>r) 
				return 0;
			if(x <= l && r<=y) {
				//if(!lazy[id])
					return tree[id];
				//else
				//	return tree[id][0];
			}
			int mid=l+(r-l)/2;
			shift(id);
			return queryUtil(x,y,2*id+1,l,mid)+queryUtil(x,y,2*id+2,mid+1,r);
		}
		public void update(int x,int y,int colour,int id,int l,int r){
			//System.out.println(l+" "+r+" "+x);
			if(x>r || y<l)
				return;
			if(x <= l && r<=y) {
				
				return;
			}
			int mid=l+(r-l)/2;
			shift(id);
			update(x,y,colour,2*id+1,l,mid);
			update(x,y,colour,2*id+2,mid+1,r);
			tree[id]=tree[2*id+1]+tree[2*id+2];
		}
		public void shift(int id) {
			
		}
	}

	public static void fft(double[] a, double[] b, boolean invert) {
		int count = a.length;
		for (int i = 1, j = 0; i < count; i++) {
			int bit = count >> 1;
			for (; j >= bit; bit >>= 1) j -= bit;
			j += bit;
			if (i < j) {
				double temp = a[i];
				a[i] = a[j];
				a[j] = temp;
				temp = b[i];
				b[i] = b[j];
				b[j] = temp;
			}
		}
		for (int len = 2; len <= count; len <<= 1) {
			int halfLen = len >> 1;
			double angle = 2 * Math.PI / len;
			if (invert) angle = -angle;
			double wLenA = Math.cos(angle), wLenB = Math.sin(angle);
			for (int i = 0; i < count; i += len) {
				double wA = 1, wB = 0;
				for (int j = 0; j < halfLen; j++) {
					double uA = a[i + j], uB = b[i + j];
					double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
					double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
					a[i + j] = uA + vA;
					b[i + j] = uB + vB;
					a[i + j + halfLen] = uA - vA;
					b[i + j + halfLen] = uB - vB;
					double nextWA = wA * wLenA - wB * wLenB;
					wB = wA * wLenB + wB * wLenA;
					wA = nextWA;
				}
			}
		}
		if (invert) {
			for (int i = 0; i < count; i++) {
				a[i] /= count;
				b[i] /= count;
			}
		}
	}
	static void multiply(long[][] a, long[][] b, long m)
	{
		int n = a.length;
		long[][] mul = new long[n][n];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				mul[i][j] = 0;
				for (int k = 0; k < n; k++)
					mul[i][j] = (mul[i][j] + (a[i][k] * b[k][j]) % m) % m;
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				a[i][j] = mul[i][j];
	}

	private static long pow(long a, long b, long c)
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}

	private static long gcd(long n, long l)
	{
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}
	public static void main(String[] args) throws Exception
	{
//		new Thread(null, new Runnable()
//		{
//			@Override
//			public void run()
//			{
//				/*try { 
//					InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in")); 
//				} catch (FileNotFoundException e) { // TODO Auto-generated catch block
//					e.printStackTrace(); 
//				} */
//				InputReader(System.in);
//				pw = new PrintWriter(System.out);
//				/*try { 
//					pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt")); 
//				} catch (FileNotFoundException e) { // TODO Auto-generated catch block
//					e.printStackTrace();
//				}*/
//				soln();
//				pw.close();
//			}
//		}, "1", 1 << 26).start();
		
		/*try { 
			InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in")); 
		} catch (FileNotFoundException e) { // TODO Auto-generated catch block
			e.printStackTrace(); 
		} */
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		/*try { 
			pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt")); 
		} catch (FileNotFoundException e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		soln();
		pw.close();
	}

	public static void InputReader(InputStream stream1)
	{
		stream = stream1;
	}

	private static boolean isWhitespace(int c)
	{
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private static boolean isEndOfLine(int c)
	{
		return c == '\n' || c == '\r' || c == -1;
	}

	private static int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream.read(buf);
			} catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private static int nextInt()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static long nextLong()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static String nextToken()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nextLine()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n)
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}

	private static long[] nextLongArray(int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextLong();
		}
		return arr;
	}

	private static void pArray(int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c)
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private static char nextChar()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(int ch);
	}
}