#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    long A[N],B[N];
    vector<long> C(N);
    long result=0;
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
        C[i]=A[i]+B[i];
        result-=B[i];
    }
    sort(C.begin(),C.end());
    reverse(C.begin(),C.end());
    for(int j=0;j<N;j=j+2){
        result+=C.at(j);
    }
  cout<<result<<endl;
}
