/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Final Contest

Solution to Bus Assignment: https://open.kattis.com/problems/busassignment
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    vector<pair<int, int>> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i].first >> p[i].second;
    }

    //The initial amount of people on the bus is the number of people
    //that get off at the first stop
    int cur = p[0].first, res = cur;
    for(int i = 0; i < n; i++) {
        //Update the current amount of people on the bus
        cur -= p[i].first;
        cur += p[i].second;

        //Set the capacity to the maximum number of people that are on the bus
        res = max(res, cur);
    }
    
    //Display the answer
    cout << res << endl;
}