/*  -*- coding: utf-8 -*-
 *
 * f.cc: F: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  ll ssum = 0, minb = 0, maxsum = 0;
  for (int i = 0; i < n; i++) {
    ll xi;
    int si;
    scanf("%lld%d", &xi, &si);

    ll b = ssum - xi;
    ssum += si;
    ll a = ssum - xi;
    if (minb > b) minb = b;
    ll sum = a - minb;
    if (maxsum < sum) maxsum = sum;
  }

  printf("%lld\n", maxsum);
  return 0;
}
