#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
typedef int _int;
#define int long long
struct ele{
	int a,b,p;
	inline bool operator<(const ele&x)const{
		return p>x.p;
	}
}o[N];
int n,ans;
_int main(){
	cin>>n;for(int i=1;i<=n;++i)cin>>o[i].a>>o[i].b,o[i].p=o[i].b+o[i].a;
	sort(o+1,o+1+n);
	for(int i=1;i<=n;++i)ans+=(i&1?o[i].a:-o[i].b);
	cout<<ans<<endl;return 0;
}
