#include<bits/stdc++.h>
#define pb push_back
#define int ll
using namespace std;
typedef long long ll;
int32_t main(){
	int n;
  cin >> n;
    vector<pair<int,int> > v;
  for (int i = 0;i < n;i++){
  	int a,b;
    cin >> a >> b;
    v.pb({a+b,b});
  }
  sort(v.rbegin(),v.rend());
	int s1 = 0,s2=  0;
  for (int i = 0;i < n;i++){
  	if (i %2)s2 += v[i].second;
    else s1 += v[i].first - v[i].second;
  }
  cout << s1 - s2 << endl;
}