import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)


  val N = in.next().toInt
  val A = new Array[Int](N+1)
  val B = new Array[Int](N+1)
  for (i <- 1 to N) {
    val a, b = in.next().toInt
    A(i) = a; B(i) = b
  }


  //
  val X = new Array[(Int, Int)](N)
  for (i <- 0 until N) {
    X(i) = (Math.abs(A(i+1) + B(i+1)), i+1)
  }

  val Y = X.sorted.reverse

  var a = 0L
  var b = 0L
  for (i <- 0 until N) {
    val (_, ind) = Y(i)
    if(i % 2 == 0)
      a += A(ind)
    else
      b += B(ind)
  }

  println(a - b)
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

