#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	long long int a[100005], b[100005], c[100005];
	long long int bsum = 0LL;
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		c[i] = a[i]+b[i];
		bsum += b[i];
	}
	sort(c,c+n);
	long long int ans = -bsum;
	for(int i=0;i<n;i++){
		if(i%2==0){
			ans += c[n-1-i];
		}
	}
	cout << ans << endl;
	return 0;
}