import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto AB = N.iota.map!(_ => readln.split.map!(to!long).array).array;
    AB.sort!((a,b) => a[0] + a[1] > b[0] + b[1]);

    long ans1 = 0;
    long ans2 = 0;

    foreach (i; 0..N) {
        if (i % 2 == 0) {
            ans1 += AB[i][0];
        } else {
            ans2 += AB[i][1];
        }
    }

    writeln(ans1 - ans2);
}
