fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val dishes = mutableListOf<Pair<Long, Long>>()

    for (i in 0 until N) {
        val (A, B) = readInputLine().split(" ").map { it.toLong() }
        dishes.add(Pair(A, B))
    }
    
    dishes.sortByDescending { it.first + it.second }

    var ans = 0L
    for ((i, e) in dishes.withIndex()) {
        ans += if (i % 2 == 0) e.first else -e.second
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}
