object Main extends App {
  import scala.io.StdIn._

  val n = readInt()
  val dinners = Array.tabulate(n){_ ⇒
    val Array(a, b) = readLine.trim.split(' ').map(_.toLong)
    (a, b)
  }.sortBy{case (a, b) ⇒ a + b}.reverse
  val sumA = dinners.map(_._1).sum
  println(sumA - (1 until n by 2).map(i ⇒ dinners(i)._1 + dinners(i)._2).sum)
}