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3 9
9 10
 10 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
 3 0
 6 6
1 2
2 3
3 1
4 5
5 6
6 4
 10 0
 9 15
1 2
2 3
3 1
1 4
4 5
5 1
1 6
6 7
7 1
1 8
8 9
9 1
2 9
7 4
2 8
 4 0
 1 0

1
 0
 43
 0
 8
 0
 84
 82
 63
 166666166667000000
 21
 30
 292
 64
 36
 0
 84
 284
 1
 37
 1
 4
 59
 50
 1
 2
 120
 28
 4
 0

#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const double eps = 1e-9;
const double pi = 4 * atan(double(1));
int cycles;
bool used[1000100];
int deg[1000100], p[1000100], a[1000100], b[1000100];
vector<int> v[1000100], h[1000100];
void dfs(int a) {
  used[a] = true;
  for (int i = 0; i < int((v[a]).size()); i++) {
    if (!used[v[a][i]]) {
      p[v[a][i]] = a;
      dfs(v[a][i]);
    } else {
      if (p[a] != -1 && v[a][i] == p[p[a]]) {
        cycles++;
      }
    }
  }
}
inline bool check(int a, int b) {
  int i = b % int((h[a]).size());
  while (h[a][i] != -1) {
    if (h[a][i] == b) {
      return true;
    }
    i++;
    if (i >= int((h[a]).size())) {
      i = 0;
    }
  }
  return false;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a[i], &b[i]);
    a[i]--;
    b[i]--;
    v[a[i]].push_back(b[i]);
    v[b[i]].push_back(a[i]);
    deg[a[i]]++;
    deg[b[i]]++;
  }
  for (int i = 0; i < n; i++) {
    h[i].resize(3 * deg[i]);
    for (int j = 0; j < int((h[i]).size()); j++) {
      h[i][j] = -1;
    }
  }
  for (int i = 0; i < m; i++) {
    int j = b[i] % int((h[a[i]]).size());
    while (h[a[i]][j] != -1) {
      j++;
      if (j >= int((h[a[i]]).size())) {
        j = 0;
      }
    }
    h[a[i]][j] = b[i];
    j = a[i] % int((h[b[i]]).size());
    while (h[b[i]][j] != -1) {
      j++;
      if (j >= int((h[b[i]]).size())) {
        j = 0;
      }
    }
    h[b[i]][j] = a[i];
  }
  cycles = 0;
  for (int i = 0; i < n; i++) {
    p[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      dfs(i);
    }
  }
  long long del = 0;
  for (int i = 0; i < n; i++) {
    if (deg[i] > 1) {
      del += long long(deg[i]) * (deg[i] - 1) / 2;
    }
  }
  del -= 3 * cycles;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < int((v[i]).size()); j++) {
      if (i < v[i][j]) {
        if (deg[i] < deg[v[i][j]]) {
          del += n - int((v[i]).size()) - int((v[v[i][j]]).size());
          for (int z = 0; z < int((v[i]).size()); z++) {
            if (v[i][z] != v[i][j] && check(v[i][j], v[i][z])) {
              del++;
            }
          }
        } else {
          del += n - int((v[i]).size()) - int((v[v[i][j]]).size());
          for (int z = 0; z < int((v[v[i][j]]).size()); z++) {
            if (v[v[i][j]][z] != i && check(i, v[v[i][j]][z])) {
              del++;
            }
          }
        }
      }
    }
  }
  long long ans = long long(n) * (n - 1) * (n - 2) / 6;
  ans -= del;
  printf("%I64d\n", ans);
  return 0;
}
