#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve();

signed main() {
#ifdef openol
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int t=1;
    //cin>>t;
    while (t--) solve();
}

void solve(){
    int n;
    cin>>n;
    vector<pair<int,int>> a(n);
    for (int i=0;i<n;i++) cin>>a[i].first>>a[i].second;
    int ans=0;
    int cur=0;
    for (int i=0;i<n;i++) {
        cur+=a[i].first;
        ans=max(ans,cur);
    }
    cout<<ans;
}