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

public class Main {

	static class Assert {
		static void check(boolean e) {
			if (!e) {
				throw new AssertionError();
			}
		}
	}

	static class Scanner implements AutoCloseable {

		InputStream is;
		byte buffer[] = new byte[1 << 16];
		int size = 0;
		int pos = 0;

		Scanner(InputStream is) {
			this.is = is;
		}

		int nextChar() {
			if (pos >= size) {
				try {
					size = is.read(buffer);
				} catch (IOException e) {
					throw new IOError(e);
				}
				pos = 0;
				if (size == -1) {
					return -1;
				}
			}
			Assert.check(pos < size);
			int c = buffer[pos] & 0xFF;
			pos++;
			return c;
		}

		int nextInt() {
			int c = nextChar();
			while (c == ' ' || c == '\r' || c == '\n' || c == '\t') {
				c = nextChar();
			}
			if (c == '-') {
				c = nextChar();
				Assert.check('0' <= c && c <= '9');
				int n = -(c - '0');
				c = nextChar();
				while ('0' <= c && c <= '9') {
					int d = c - '0';
					c = nextChar();
					Assert.check(n > Integer.MIN_VALUE / 10 || n == Integer.MIN_VALUE / 10 && d <= -(Integer.MIN_VALUE % 10));
					n = n * 10 - d;
				}
				return n;
			} else {
				Assert.check('0' <= c && c <= '9');
				int n = c - '0';
				c = nextChar();
				while ('0' <= c && c <= '9') {
					int d = c - '0';
					c = nextChar();
					Assert.check(n < Integer.MAX_VALUE / 10 || n == Integer.MAX_VALUE / 10 && d <= Integer.MAX_VALUE % 10);
					n = n * 10 + d;
				}
				return n;
			}
		}

		@Override
		public void close() {
		}
	}

	@SuppressWarnings("serial")
	static class IntArrayList extends ArrayList<Integer> {}

	void visit(int cur, IntArrayList next[], boolean visited[]) {
		if (visited[cur]) {
			return;
		}
		visited[cur] = true;
		for (int x : next[cur]) {
			visit(x, next, visited);
		}
	}
	
	void solve(Scanner in, PrintWriter out) {
		int nV = in.nextInt();
		int nE = in.nextInt();
		IntArrayList next[] = new IntArrayList[nV];
		for (int i = 0; i < nV; i++) {
			next[i] = new IntArrayList();
		}
		boolean hasLoop[] = new boolean[nV];
		int nLoops = 0;
		for (int i = 0; i < nE; i++) {
			int v1 = in.nextInt() - 1;
			int v2 = in.nextInt() - 1;
			if (v1 == v2) {
				hasLoop[v1] = true;
				nLoops++;
			} else {
				next[v1].add(v2);
				next[v2].add(v1);
			}
		}
		boolean visited[] = new boolean[nV];
		visit(0, next, visited);
		for (boolean v : visited) {
			if (!v) {
				out.println(0);
				return;
			}
		}
		long sum = 0;
		for (int i = 0; i < nV; i++) {
			int roads = next[i].size();
			sum += 1L * roads * (roads - 1) / 2;
		}
		sum += 1L * nLoops * (nLoops - 1) / 2;
		sum += 1L * nLoops * (nE - nLoops);
		out.println(sum);
	}

	void run() {
		try (
			Scanner in = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out)) {

			solve(in, out);
		}
	}

	public static void main(String args[]) {
		new Main().run();
	}
}
