#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<pair<ll,ll>> P(N);
	ll SA=0,SB=0;
	REP(i,N){
		P[i].first=in();
		P[i].second=in();
		SB += P[i].second;
	}

	sort(ALL(P),[](pair<ll,ll>& l,pair<ll,ll>& r){return l.first+l.second>r.first+r.second;});

	int H=ceil(N/2.0);
	REP(i,H){
		SA += P[2*i].first;
		SB -= P[2*i].second;
	}
	
	out(SA-SB);
	return 0;
}

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
int sa[100010];
signed main(){
  int n;cin>>n;
  int ans=0;
  rep(i,n){
    int a,b;cin>>a>>b;
    sa[i]=a+b;
    ans-=b;
  }
  sort(sa,sa+n,greater<int>());
  for(int i=0;i<n;i+=2){
    ans+=sa[i];
  }
  cout<<ans<<endl;
  return 0;
}
