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 sys
import fileinput


def solve():
    m = -1
    edges = []
    for line in sys.stdin:
        if m == -1:
            n, m = int(line[0]), int(line[2])
        else:
            edges.append((int(line[0]), int(line[2])))
            m -= 1
            if m == 0:
                break

    visited = [0] * n
    vertices = [[] for _ in range(n)]

    cnt = [0] * n
    loops = 0

    for v, u in edges:
        v, u = v - 1, u - 1

        if v == u:
            loops += 1
            vertices[v].append(u)

        else:
            cnt[v] += 1
            cnt[u] += 1
            vertices[v].append(u)
            vertices[u].append(v)

    dfs(visited, vertices, 0)
    for v in visited:
        if v == 0:
            return 0

    result = 0

    factorials_list = factorials(max(loops, max(cnt)))

    for c in cnt:
        result += combinations(c, 2, factorials_list)

    result += loops * (m - 1)
    result -= combinations(loops, 2, factorials_list)
    print(result)


def combinations(n, k, factorials):
    return int(factorials[n] / (factorials[n - k] * factorials[k]))


def factorials(n):
    factorial_list = [1] * (n + 1)
    fact = 1
    for i in range(1, n + 1):
        fact = fact * i
        factorial_list[i] = fact

    return factorial_list


def dfs(visited, graph, node):
    if visited[node] == 0:
        visited[node] = 1
        for neighbour in graph[node]:
            dfs(visited, graph, neighbour)


solve()
