#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
ll d[100005];
int main() {
  int N;
  cin >> N;
  ll a, b;
  ll ret = 0;
  for (int i=0; i<N; i++) {
    cin >> a >> b;
    ret -= b;
    d[i] = a + b;
  }
  sort(d, d+N, greater<ll>());
  for (int i=0; i<N; i+=2) {
    ret += d[i];
  }
  cout << ret << endl;
}