#include<bits/stdc++.h>
using namespace std;
const int N=100000+10;
int n;
struct dish{
	int x,y;
	bool operator < (const dish &rhs) const {
		return x+y>rhs.x+rhs.y;
	}
}a[N];

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+n+1);
	
	long long ans=0;
	for (int i=1;i<=n;i++) {
		if (i%2) ans+=(long long)a[i].x;
			else ans-=(long long)a[i].y;
	}
	cout<<ans;
	return 0;
}