#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
struct point {
  long long x, y;
  point() {}
  point(long long x, long long y) : x(x), y(y) {}
};
long long n;
long long x[N], sum_sqrX[N], sumX[N];
point a[N];
long long does() {
  sort(x + 1, x + 1 + n);
  for (long long i = 1; i <= n; i++) {
    sumX[i] = sumX[i - 1] + x[i];
    sum_sqrX[i] = sum_sqrX[i - 1] + x[i] * x[i];
  }
  long long res = 0;
  for (long long i = 1; i <= n; i++) {
    res += -2 * x[i] * sumX[i - 1] + (i - 1) * (x[i] * x[i]) + sum_sqrX[i - 1];
  }
  return res;
}
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i].x >> a[i].y;
  for (long long i = 1; i <= n; i++) x[i] = a[i].x;
  long long res = does();
  for (long long i = 1; i <= n; i++) x[i] = a[i].y;
  res += does();
  cout << res;
}
