fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    data class Cuisine(val a: Long, val b: Long, val t: Long)

    val n = readLine()?.toInt() ?: return
    val cuisines = mutableListOf<Cuisine>()
    repeat(n) {
        val (a, b) = longList()
        cuisines.add(Cuisine(a, b, a + b))
    }
    cuisines.sortByDescending { it.t }
    var at = 0L
    var bt = 0L
    cuisines.forEachIndexed { i, (a, b, _) ->
        if (i % 2 == 0) {
            at += a
        } else {
            bt += b
        }
    }
    println((at - bt).toString())
}