#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using Vb = vector<bool>;
using Vi = vector<int>;
using Vll = vector<ll>;
using VVb = vector<Vb>;
using VVi = vector<Vi>;
using VVll = vector<Vll>;
using VVVb = vector<VVb>;
using VVVi = vector<VVi>;
using VVVll = vector<VVll>;
const ll ms = 11234;
int main() {
  ll minCap, actualCap;
  minCap = actualCap = 0;
  int n, a;
  cin >> n;
  while (n--) {
    cin >> a;
    actualCap -= a;
    cin >> a;
    actualCap += a;
    minCap = max(actualCap, minCap);
  }
  cout << minCap << endl;
}
