    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]
    		}
    	}
    	
    	//output
    	console.log(aHappiness-bHappiness)
    }
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));