#include<bits/stdc++.h>

using namespace std;

int main() {
   long n,b_sum=0;
   cin >> n;
   long a[n],b[n],c[n];
   for(int i=0;i<n;i++){
      cin >> a[i] >> b[i];
      c[i] = a[i] + b[i];
      b_sum += b[i];
   }

   sort(c,c+n);
   reverse(c,c+n);

   long score=0;
   for(int i=0;i<n;i++){
      if(i%2==0){
         score += c[i];
      }
   }
   score -= b_sum;
   cout << score << endl;
   return 0;
}
