function main(input){
  var n = parseInt(input[0]);
  var a = [];
  var b = [];
  for (var i = 0; i< n; i++) {
    var ab = input[i+1].split(' ');
    a.push(parseInt(ab[0]));
    b.push(parseInt(ab[1]));
  }

  var score = [];
  for (var i = 0; i< n; i++) {
    score.push({score: a[i]+b[i], a: a[i], b:b[i]});
  }

  score = score.sort((a,b) => b.score-a.score);
  var as = 0;
  var bs = 0;
  for (var i = 0; i < n; i++){
    if (i%2 === 0) {
      as+= score[i].a;
    } else {
      bs+=score[i].b;
    }
  }
  console.log(as-bs);
}

var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main(input);
});
