"use strict";
function Main(input) {
    var lines = input.split("\n");
    var N = lines.shift() - 0;
    var ryo = new Array(N);
    for (var n = 0; n < N; n++) {
        var nums = lines[n].split(" ");
        ryo[n] = {
            taka : nums[0] - 0,
            aoki : nums[1] - 0,
        };
        ryo[n].wa = ryo[n].taka + ryo[n].aoki;
    }
    ryo.sort(function(a, b) { return b.wa - a.wa; });
    var koufuku = 0, c = 0;
    for (var n = 0; n < N; n += 2) {
        koufuku += ryo[n].wa;
    }
    ryo.forEach(function(value) {koufuku -= value.aoki});
    console.log(koufuku);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
