import std.stdio, std.string, std.conv;
import std.algorithm, std.array, std.range;
auto solve(string s_) {
    auto N = s_.chomp.to!int();
    auto A = new int[N];
    auto B = new int[N];
    auto P = new int[N];
    foreach(i;0..N) {
        auto AB = readln.split.map!(to!int)();
        A[i]=AB[0];
        B[i]=AB[1];
        P[i]=A[i]+B[i];
    }
    bool p=false;
    long s=0;
    foreach(t;zip(P,A,B).sort!((t1,t2)=>t1[0]>t2[0])) {
        if(p) s-=t[2];
        else  s+=t[1];
        p=!p;
    }
    return s;
}
void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }