#include<bits/stdc++.h>
using namespace std;
#define int64 long long int
int main(){
	int n;
	ios::sync_with_stdio(false);
	cin >> n;
	int64 sum = 0, z = (int64)2e18, res = 0;
	for(int i=1; i<=n; i++){
		int64 cur, pro;
		cin >> cur >> pro;
		z = min(z, sum - cur);
		sum += pro;
		res = max(res, sum - cur - z);
	}
	cout << res <<endl;
	return 0;
}