local n = io.read("*n")
local t, bsum = {}, 0
for i = 1, n do
  local a, b = io.read("*n", "*n")
  t[i] = a + b
  bsum = bsum + b
end
table.sort(t, function(x, y) return x > y end)
local ret = 0
for i = 1, n, 2 do
  ret = ret + t[i]
end
print(ret - bsum)
