#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 10;
long long a[N], b[N], c[N], d[N], s[N], s2[N], ans;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  sort(a, a + n);
  sort(b, b + n);
  for (int i = 1; i < n; i++) {
    c[i] = c[i - 1] + i * (b[i] - b[i - 1]) * (b[i] - b[i - 1]) +
           2 * (b[i] - b[i - 1]) * s[i - 1];
    s[i] = s[i - 1] + i * (b[i] - b[i - 1]);
    d[i] = d[i - 1] + i * (a[i] - a[i - 1]) * (a[i] - a[i - 1]) +
           2 * (a[i] - a[i - 1]) * s2[i - 1];
    s2[i] = s2[i - 1] + i * (a[i] - a[i - 1]);
    ans += c[i] + d[i];
  }
  cout << ans;
}
