#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[200000],b[200000];
ll  c[200000];

int main() {
	//ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	ll ans=0;
	for(int i=0;i<n;i++){
	    c[i]=a[i]+b[i];
	    ans-=b[i];
	}
	sort(c,c+n);
//cout<<ans<<endl;
	for(int i=0;i<n;i++){
	    if((i+n+1)%2==0) ans+=c[i];   
	}
	cout<<ans;
	return 0;
}