#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;

ll N;
ll A[100000], B[100000];
ll sum[100000];

int main(){
    cin>>N;
    rep(i,N){
        cin>>A[i]>>B[i];
        sum[i]=A[i]+B[i];
    }

    ll ans=0;
    rep(i,N) ans-=B[i];

    sort(sum,sum+N,greater<>());

    for(int i=0;i<N;i+=2) ans+=sum[i];

    cout<<ans<<endl;
}
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

struct dish {
	ll x, y;

	dish(ll tx = 0, ll ty = 0) {
		x = tx;
		y = ty;
	}

	void read() {
		cin >> x >> y;
	}

	bool operator<(const dish & d) const {
		return (x + y > d.x + d.y);
	}
};

#define MAXN (1 << 17)

dish a[MAXN];
int n;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		a[i].read();
	}
	sort(a, a + n);
	ll ret = 0;
	for (int i = 0; i < n; i++) {
		if (i & 1) {
			ret -= a[i].y;
		} else {
			ret += a[i].x;
		}
	}
	cout << ret << endl;

	return 0;
}
