#include <bits/stdc++.h>
using namespace std;
long long calc(vector<int> p) {
  long long a = 0;
  long long b = 0;
  long long ret = 0;
  for (int i = 1; i < p.size(); i++) {
    int d = p[i] - p[i - 1];
    a = a + 1LL * (i)*d * d + 2LL * d * b;
    b += 1LL * (i)*d;
    ret += a;
  }
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> xs(n);
  vector<int> ys(n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &xs[i], &ys[i]);
  }
  if (n == 0) {
    printf("0\n");
    return 0;
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());
  cout << calc(xs) + calc(ys) << endl;
  return 0;
}
