import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val AB = Array.fill(N)(sc.nextLong, sc.nextLong)
      .map(ab => (ab._1, ab._2, ab._1 + ab._2))
      .sortBy(_._3).reverse

    val Asum = (for (i <- 0 until N by 2) yield AB(i)._1).sum
    val Bsum = (for (i <- 1 until N by 2) yield AB(i)._2).sum
    (Asum - Bsum).toString
  }
}
