#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int prefix[100000];
pair<int, int> p[100010];
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 >> p[i].first >> p[i].second;
    }
    sort(p, p + n);
    prefix[0] = p[0].first;
    for (int i = 1; i < n; i++) {
        prefix[i] = prefix[i - 1] + p[i].first;
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += (p[i].first - p[0].first) * (p[i].first - p[0].first);
    }
    ans += sum;
    for (int i = 1; i < n; i++) {
        sum += n * p[i].first * p[i].first - n * p[i - 1].first * p[i - 1].first;
        sum -= 2 * prefix[n - 1] * (p[i].first - p[i - 1].first);
        ans += sum;
    }
    for (int i = 0; i < n; i++) {
        swap(p[i].first, p[i].second);
    }
    sort(p, p + n);
    prefix[0] = p[0].first;
    for (int i = 1; i < n; i++) {
        prefix[i] = prefix[i - 1] + p[i].first;
    }
    sum = 0;
    for (int i = 0; i < n; i++) {
        sum += (p[i].first - p[0].first) * (p[i].first - p[0].first);
    }
    ans += sum;
    for (int i = 1; i < n; i++) {
        sum += n * p[i].first * p[i].first - n * p[i - 1].first * p[i - 1].first;
        sum -= 2 * prefix[n - 1] * (p[i].first - p[i - 1].first);
        ans += sum;
    }
    cout << ans / 2;
    return 0;
}

