#include <iostream>
using namespace std;
int a[200005], b[200005], n;
long long ans, t;
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i] >> b[i];
ans = t = 0;
for (int i = 1; i <= n; i++) {
t += a[i];
ans = max(ans, t);
ans += b[i];
}
cout << ans;
return 0;
}
评论区