#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#ifndef ABOBA
#pragma GCC traget("avx2")
#pragma GCC optimize("O3")
#endif

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uint = unsigned int;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

constexpr ll inf = 1e18, mod = 998244353;

int main() {
    ll n, ans = 0, pref = 0;
    cin >> n;
    vector<pair<ll, ll> > a(n);
    for (auto &[b, k]: a) {
        cin >> b >> k;
        pref += b;
        ans = max(ans, pref);
    }
    cout << ans;
}

void solve() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll tt = 1;
    //cin >> tt;
    while (tt--) solve();
}
