#include <bits/stdc++.h>
using namespace std;
long long cnt_trng(vector<long> adj[], long d[], bool vis[], long pos) {
  vis[pos] = true;
  long long ans = 0LL;
  for (long i = 0; i < adj[pos].size(); i++) {
    if (!vis[adj[pos][i]]) {
      d[adj[pos][i]] = 1 + d[pos];
      ans += cnt_trng(adj, d, vis, adj[pos][i]);
    } else {
      if (d[adj[pos][i]] == d[pos] + 2) ans++;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long n, m, u, v;
  cin >> n >> m;
  vector<long> adj[n + 1];
  for (long i = 0; i < m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  bool vis[n + 1];
  long d[n + 1];
  memset(vis, false, sizeof(vis));
  long long ans = 0LL, ans1 = 0LL;
  for (long i = 1; i <= n; i++) {
    ans1 += (adj[i].size() * (adj[i].size() - 1)) / 2;
    if (!vis[i]) {
      d[i] = 0;
      ans += cnt_trng(adj, d, vis, i);
    }
  }
  ans1 -= 3LL * ans;
  ans1 = ((long long)(n - 2)) * ((long long)(m)) - 3LL * ans - ans1;
  ans1 = (1LL * n * (n - 1) * (n - 2)) / 6 - ans1;
  cout << ans1 << endl;
}
