#include <bits/stdc++.h>
using namespace std;
int n;
int ai, bi, numOfCurrPeople, resp;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ai >> bi;
    numOfCurrPeople -= ai;
    numOfCurrPeople += bi;
    if (numOfCurrPeople > resp) resp = numOfCurrPeople;
  }
  cout << resp;
  return 0;
}
