#include <bits/stdc++.h>
using namespace std;
long long X[100001];
long long Y[100001];
long long sumCuadrados(long long* P, int N) {
  long long SC = P[0] * P[0];
  long long Suma = P[0];
  long long ans = 0;
  for (int i = (int)(1); i < ((int)N); i++) {
    ans += (long long)(i)*P[i] * P[i] - 2LL * P[i] * Suma + SC;
    Suma += P[i];
    SC += P[i] * P[i];
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i = 0; i < (int)(N); i++) {
    cin >> X[i] >> Y[i];
  }
  sort(X, X + N);
  sort(Y, Y + N);
  cout << sumCuadrados(X, N) + sumCuadrados(Y, N) << endl;
  return 0;
}
