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 B
{
   public static void main(String[] args) throws Exception
   {
      PrintWriter out = new PrintWriter(System.out);
      new B(new FastScanner(System.in), out);
      out.close();
   }

   long choose2(long n)
   {
      return n*(n-1L)/2;
   }

   public B(FastScanner in, PrintWriter out)
   {
      int N = in.nextInt();
      int[] loops = new int[N];

      DisjointSet ds = new DisjointSet(N);

      int[] numAdj = new int[N];
      boolean[] seen = new boolean[N];
      int numNormal = 0;
      int M = in.nextInt();
      while (M-->0)
      {
         int i = in.nextInt()-1;
         int j = in.nextInt()-1;

         ds.union(i,j);

         numAdj[i]++;
         numAdj[j]++;

         if (i == j)
            loops[i]++;
         else
         {
            numNormal++;
            seen[i] = seen[j] = true;
         }
      }


      if (ds.numComps > 1)
      {
         out.println(0);
         return;
      }

      long res = 0;
      for (int i=0; i<N; i++)
         if (seen[i])
            res += choose2(numAdj[i]-2*loops[i]);

      int totalLoops = 0;
      for (int ll : loops)
         totalLoops += ll;

      res += choose2(totalLoops);
      res += totalLoops * 1L * numNormal;

      out.println(res);
   }
}


class DisjointSet {
	int[] p, r;
   int numComps;
	DisjointSet(int s) {
		p = new int[s];
		r = new int[s];
		for(int i=0; i<s; i++)
			p[i] = i;
      numComps = s;
	}
	void union(int x, int y) {
		int a = find(x);
		int b = find(y);
		if(a==b) return;
      numComps--;
		if(r[a] == r[b])
			r[p[b]=a]++;
		else 
			p[a]=p[b]=r[a]<r[b]?b:a;
	}
	int find(int x) {
		return p[x]=p[x]==x?x:find(p[x]);
	}
}

class FastScanner{
   private InputStream stream;
   private byte[] buf = new byte[1024];
   private int curChar;
   private int numChars;

   public FastScanner(InputStream stream)
   {
      this.stream = stream;
   }

   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++];
   }

   boolean isSpaceChar(int c)
   {
      return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
   }
   
   boolean isEndline(int c)
   {
      return c=='\n'||c=='\r'||c==-1;
   }

   int nextInt()
   {
      return Integer.parseInt(next());
   }
   
   long nextLong()
   {
      return Long.parseLong(next());
   }

   double nextDouble()
   {
      return Double.parseDouble(next());
   }

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