#include <iostream>
#include <algorithm>
using namespace std;
int x[100000], y[100000];
long long prefix[100000];
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    sort(x, x + n);
    prefix[0] = x[0];
    for (int i = 1; i < n; i++) {
        prefix[i] = prefix[i - 1] + x[i];
    }
    long long sum = 0;
    for (int i = 1; i < n; i++) {
        sum += (x[i] - x[0]) * (x[i] - x[0]);
    }
    ans += sum;
    for (int i = 1; i < n; i++) {
        sum += n * x[i] * x[i] - n * x[i - 1] * x[i - 1];
        sum -= 2 * prefix[n - 1] * (x[i] - x[i - 1]);
        ans += sum;
    }

    sort(y, y + n);
    prefix[0] = y[0];
    for (int i = 1; i < n; i++) {
        prefix[i] = prefix[i - 1] + y[i];
    }
    sum = 0;
    for (int i = 1; i < n; i++) {
        sum += (y[i] - y[0]) * (y[i] - y[0]);
    }
    ans += sum;
    for (int i = 1; i < n; i++) {
        sum += n * y[i] * y[i] - n * y[i - 1] * y[i - 1];
        sum -= 2 * prefix[n - 1] * (y[i] - y[i - 1]);
        ans += sum;
    }
    cout << ans / 2;
    return 0;
}

