/*var maxHappiness = 99999
var randomInput = `10
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}
${Math.floor(Math.random() * maxHappiness)} ${Math.floor(Math.random() * maxHappiness)}` */

//console.log(randomInput)


// parameter "input" gets all data
function Main(input) {
	// n is the first element
	var splitInput = input.split("\n");
	var n = parseInt(splitInput[0])
	
	// plate array is [ aHappiness, bHappiness, sumABHappiness ] sorted by sumABHappiness
	var plateArray = splitInput.slice(1).map(function(e){
		var splitab = e.split(" ")
		return [parseInt(splitab[0]),parseInt(splitab[1]),parseInt(splitab[0])+parseInt(splitab[1])]
	}).sort(function(x,y) {
		if (x[2] > y[2]) {
			return (-1) // desc order
		}
		if (x[2] < y[2]) {
			return 1 // desc order
		}
		  return 0;
	})
	
	console.log(plateArray)
	
	var aHappiness = 0
	var bHappiness = 0
	
	for (var i=0; i<n; i++){
		if (i%2 == 0) {
			//console.log('a take %d happiness', plateArray[i][i%2])
			aHappiness += plateArray[i][i%2]
		} else {
			//console.log('b take %d happiness', plateArray[i][i%2])
			bHappiness += plateArray[i][i%2]
		}
	}
	
	var sumOfTotalHappinessAvailableForB = 0
	for (var i=0; i<n; i++) {
		sumOfTotalHappinessAvailableForB += plateArray[i][1]
	}
	
	var sumOfHappinessTakenByA = 0
	// 
	for (var i=0; i < n; i += 2){
		sumOfHappinessTakenByA += plateArray[i][2]
	}
	
	//console.log('%d', sumOfHappinessTakenByA-sumOfTotalHappinessAvailableForB)
	
	//output
	console.log('%d',aHappiness-bHappiness);
}
// Don't edit this line!
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main(randomInput)