#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
long long ans, sx2, sx;
long long x[N], y[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
  }
  ans = 0;
  sort(x, x + n);
  sort(y, y + n);
  sx2 = x[0] * x[0];
  sx = x[0];
  for (int i = 1; i < n; i++) {
    ans += (i)*x[i] * x[i] + sx2 - 2 * x[i] * sx;
    sx2 += x[i] * x[i];
    sx += x[i];
  }
  sx2 = y[0] * y[0];
  sx = y[0];
  for (int i = 1; i < n; i++) {
    ans += (i)*y[i] * y[i] + sx2 - 2 * y[i] * sx;
    sx2 += y[i] * y[i];
    sx += y[i];
  }
  printf("%lld\n", ans);
  return 0;
}
