#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main()
{
  int64 N, X[200000], S[200000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> X[i] >> S[i];
  }

  // ∑_{i=L}^{R} S[i] - (X[R]-X[L])
  // ∑_{R} S[i] - ∑_{L-1} S[i] + (X[L] - X[R])
  // Z[i] = ∑_{i} S[i]
  // Z[R]-Z[L-1]+X[L]-X[R]
  // (X[L]-Z[L-1]) + (Z[R]-X[R])

  int64 ret = 0;
  int64 beet = 0, sum = 0;
  for(int i = 0; i < N; i++) {
    beet = max(beet, X[i] - sum);
    sum += S[i];
    ret = max(ret, beet + sum - X[i]);
  }
  cout << ret << endl;
}