#include<bits/stdc++.h>
using namespace std;

long long n,x[100007],y[100007];
long long a[100007],b[100007];
long long pref[100007],suff[100007];

long long ans,curr;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(long long i=1;i<=n;i++){
        cin>>x[i]>>y[i];
    }
    sort(x+1,x+n+1);
    sort(y+1,y+n+1);

    for(long long i=1;i<=n-1;i++){
        a[i]=x[i+1]-x[i];
        pref[i]=pref[i-1]+a[i]*i;
    }
    for(long long i=n-1;i>=1;i--){
        suff[i]=suff[i+1]+a[i]*(n-i);
    }
    for(long long i=1;i<=n-1;i++){
        ans+=a[i]*(pref[i-1]*(n-1-i+1)+suff[i+1]*i+a[i]*i*(n-i));
    }

    for(long long i=1;i<=n-1;i++){
        b[i]=y[i+1]-y[i];
        pref[i]=pref[i-1]+b[i]*i;
    }
    for(long long i=n-1;i>=1;i--){
        suff[i]=suff[i+1]+b[i]*(n-i);
    }
    for(long long i=1;i<=n-1;i++){
        ans+=b[i]*(pref[i-1]*(n-1-i+1)+suff[i+1]*i+b[i]*i*(n-i));
    }

    cout<<ans<<"\n";

    return 0;
}

