#include <iostream>
#include <algorithm>

using namespace std;

int p[100001];
int main(){
    int n;
    cin>>n;
    long long r = 0;
    for(int i = 0;i<n;i++){
        int a = 0;
        int b = 0;
        cin>>a>>b;
        p[i] = -(a+b);
        r -=b;
    }
    sort(p,p+n);
    for(int j = 0;j<n;j+=2)
        r-=p[j];
    cout<<r<<endl;
    return 0;
}