"use strict";
function Main(input) {
    var lines = input.split("\n");
    var N = lines.shift() - 0;
    var ab = new Array(N);
    for (var n = 0; n < N; n++) {
        var nums = lines[n].split(" ");
        ab[n] = {
            t : nums[0] - 0,
            a : nums[1] - 0,
        };
        ab[n].wa = ab[n].t + ab[n].a;
    }
    ab.sort(function(a, b) { return b.wa - a.wa; });
    var ans = 0;
    for (var n = 0; n < N; n++) {
        ans += (n % 2 == 0) ? ab[n].t : - ab[n].a;
    }
    console.log(ans);
}

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