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;
	})
	
	var aHappiness = 0
	var bHappiness = 0
	
	for (var i=0; i<n; i++){
		if (i%2 == 0) {
			aHappiness += plateArray[i][i%2]
		} else {
			bHappiness += plateArray[i][i%2]
		}
	}
	
	//output
	console.log(aHappiness-bHappiness)
}

// HOTFIX: If the I add the last \n even if the loop never goes to the last element of the list, an NaN error is thrown
var str = require("fs").readFileSync("/dev/stdin", "utf8")
Main(str);