#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef tuple<ll,ll,ll> T;
int main(){
  ll n,x=0,y=0;
  cin>>n;
  ll a[n],b[n];
  vector<T> p(n);
  for(ll i=0;i<n;i++){
    cin>>a[i]>>b[i];
    p.push_back(T(a[i]+b[i],a[i],i));
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  for(int i=0;i<n;i++){
    if(i%2==0){
      x+=a[get<2>(p[i])];
    }else{
      y+=b[get<2>(p[i])];
    }
  }
  cout<<x-y;
}
