#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> p;
typedef vector<int> vi;
typedef vector<ll> vl;
set <int> st;
vector<int> videos(105);
double now=0;
queue<int> num;
ll n,k,ans=-1;
ll s[200005];
ll ss[200005];
ll x[200005];
ll a[200005];
ll b[200005];
ll bmin=2e18;
int main(int argc,char const* argv[])
{
  cin >> n; 
  for(int i=0;i<n;i++)
    {
      if(i!=0) ss[i]+=ss[i-1];
      cin >> x[i] >> s[i];
      ss[i]+=s[i];
      a[i]=-x[i];
      b[i]=-x[i];
    }
  for(int i=0;i<n;i++)
    {
      if(i!=0) 
	{
	  a[i]+=ss[i-1];
	}
      b[i]=a[i];
      a[i]+=s[i];
    }
  for(int i=0;i<n;i++)
    {
      if(b[i]<bmin) bmin=b[i];
      if(a[i]-bmin>ans) ans=a[i]-bmin;
    }

  cout << ans << endl;
  return 0;
}
