// Arup Guha
// 6/17/2026
// Solution to Kattis Problem: Bus Assignment
// https://open.kattis.com/problems/busassignment

using namespace std;
#include <bits/stdc++.h>

int main() {

    // Stores # kids on bus and maximum.
    int n, onbus = 0, maxbus = 0;
    cin >> n;

    // Go through each stop.
    for (int i=0; i<n; i++) {

        int off, on;
        cin >> off >> on;

        // Update bus.
        onbus += (on - off);

        // And max.
        maxbus = max(onbus, maxbus);
    }

    // Ta da!
    cout << maxbus << endl;
    return 0;
}
