#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int n;
long long sol(long long* data) {
  long long ans = 0, fang = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    ans += data[i] * data[i] * (i - 1);
    ans -= sum * data[i] * 2;
    ans += fang;
    fang += data[i] * data[i];
    sum += data[i];
  }
  return ans;
}
long long x[maxn], y[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld%lld", x + i, y + i);
  sort(x + 1, x + n + 1);
  sort(y + 1, y + n + 1);
  cout << sol(x) + sol(y) << endl;
}
