import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

class X{
	long a;
	long b;
	long id;
	this(long id, long a, long b){
		this.id = id;
		this.a = a;
		this.b = b;
	}
	long c(){
		return a + b;
	}
}	

void main(){
	long n = read.to!long;
	X[] xs;
	foreach(i; 0 .. n){
		xs ~= new X(i, read.to!long, read.to!long);
	}
	
	xs.sort!"a.c > b.c"();
	
	long ans;
	foreach(i, x; xs){
		if(i % 2 == 0) ans += x.a;
		else ans -= x.b;
	}
	
	ans.writeln;
	
}
