#include <iostream>

#define endl '\n'

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    int64_t sumx = 0, sumy = 0;
    int64_t product_sum = 0;

    int64_t res = 0;
    for (int i = 0; i < n; ++i) {
        int64_t x, y;
        cin >> x >> y;

        res += i * x * x;
        res += i * y * y;

        res += product_sum;
        res -= 2 * x * sumx;
        res -= 2 * y * sumy;

        product_sum += x * x + y * y;
        sumx += x;
        sumy += y;
    }

    cout << res << endl;

return 0;
}
