#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
	int N; cin >> N;
	vector<long long>A(N);
	long long B, C, ans = 0, sum = 0;

	for (int i = 0; i < N; i++) {
		cin >> B >> C;
		A.at(i) = B + C;
		ans += C;
	}
	sort(A.begin(), A.end(), greater<long long>());
	for (int i = 0; i < N; i += 2) {
		sum += A.at(i);
	}
	cout << sum - ans << endl;
}