import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}

func main() {
    let n = Int(readLine()!)!

    // 自分にとってプラスで相手にとってマイナス
    let dishes = (0..<n).map { i -> (Int, Int) in 
        let ab = readWords { Int($0)! }
        let a = ab[0]
        let b = ab[1]
        return (a, b)
    }.sorted { $0.0 + $0.1 > $1.0 + $1.1 }

    var t = 0
    var a = 0
    for (i, dish) in dishes.enumerated() {
        if i % 2 == 0 {
            t += dish.0
        } else {
            a += dish.1
        }
    }

    print(t - a)
}
main()